4 ms·
Personally I'd make everything const instead of let and use for of instead of forEach, but it's like 10 lines of code it doesn't really matter.
by AlienRobot 1y ago
Personally I'd make everything const instead of let and use for of instead of forEach, but it's like 10 lines of code it doesn't really matter.
- Sharlin 1y agoAre you sure this old API does the right thing with for…of?
- kaoD 1y agoIt's only used to iterate the array
- Sharlin 1y agoOops, right, I confused the variables.
- runarberg 1y agoShould work just fine: > document.createElement("table").rows[Symbol.iterator]() // Array Iterator { constructor: Iterator() } HTMLTableElement.prototype.rows actually just returns a HTMLCollection, so same as document.forms, or document.getElementsByClassName. HTMLCollection implements Symbol.iterator as you would expect. https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/rows https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableEl...