re: How do I use .forEach on DOM Elements? VIEW POST

FULL DISCUSSION
 

use the "…" spread operator, which works for both getElementsByClassName() and querySelectorAll() so you can port easily later.

// example to run on this page
[...document.getElementsByClassName("stories")].forEach(node => console.log(node));
code of conduct - report abuse