I feel like using the basic for statement
iteration on NodeLists is bulky.
And i plan on implementing forEach()
on NodeLists.
Am worried that there may be some issues with doing so i.e compatibility etc.
From my research, it seems that there is nothing to be worried about. Check here: javascript forEach on nodelist
Question:
Is there any concern before implementing it in the production environment ?.
Asked
Active
Viewed 30 times
0

Community
- 1
- 1

steven7mwesigwa
- 5,701
- 3
- 20
- 34
-
What do you mean by **concerns**? – ibrahim mahrir Feb 05 '17 at 08:36
-
2as it's only supported in chrome 51, firefox 50, opera 38 and safari 10 ... then the only possible problem is with IE (and edge?) ... of course you can polyfill, or use `[].forEach.call(nodelist, fn)` in any browser that supports array.forEach – Jaromanda X Feb 05 '17 at 08:36
-
@JaromandaX Whenever something cool comes out, there will be IE saying **NO, DON'T USE THAT**. – ibrahim mahrir Feb 05 '17 at 08:38
-
As IE is a dead browser it's no wonder. That's why I mentioned polyfill and alternate method – Jaromanda X Feb 05 '17 at 08:57
-
@JaromandaX I have checked compatibility for `array.forEach()` here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach. And it looks to be performing well except for IE 9. Does this mean it would be unnecessary to add its polyfill to my script ? – steven7mwesigwa Feb 05 '17 at 15:23