Yep. Wish we could use forEach on arrays. At the moment, I just convert them over to arrays by using the spread operator:
// return a node-listconstdomItems=document.querySelectorAll('.dom-items')// takes all those node-list items and dumps them in an arrayconstdomItems=[...document.querySelectorAll('.dom-items')]
At first, I would just use the forEach and continue to treat it as a node-list unless but I needed it in an array form, but Babel apparently doesn't convert forEach to IE11 friendly syntax. So now, I just convert node-lists to arrays and then go on from there unless I add a specific IE11 polyfill.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yep. Wish we could use
forEach
on arrays. At the moment, I just convert them over to arrays by using the spread operator:At first, I would just use the
forEach
and continue to treat it as a node-list unless but I needed it in an array form, but Babel apparently doesn't convertforEach
to IE11 friendly syntax. So now, I just convert node-lists to arrays and then go on from there unless I add a specific IE11 polyfill.