and something that should be avoided in general. Now, the former does have forEach defined - but it's pretty much the only array method that has been added to its prototype so far.īut it's only a relatively recent addition, so older browsers don't support it - fortunately, the Array#forEach trick works pretty well, down to sufficiently old Internet Explorer versions (probably 6? 5.5? The heck am I saying, that could work for slice, but forEach was added only in IE9.).Ī HTMLCollection is a totally different beast. A small correction: you used document.getElementsB圜lassName which does not return a NodeList but a HTMLCollection.
0 Comments
Leave a Reply. |