Hacker News new | ask | show | jobs
by AlienRobot 237 days 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.
1 comments

Are you sure this old API does the right thing with for…of?
Should 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/HTMLTableEl...

It's only used to iterate the array
Oops, right, I confused the variables.