Better HN
topnewbestaskshowjobs
Log inSign up

fabien_

1 karma · joined Jul 3, 2015 (11y ago) · 1 submissions

Submissions

comment 11y ago · link · parent

Underscore : _.each(array, iteratee) ES5.1 : array.forEach(iteratee)

And all the other elements...

Yes, you are right. But... The "array" is not always an Array. document.getElementsByClassName( 'myClass' ) is not an Array but a DOMNodeList. So document.getElementsByClassName( 'myClass' ).forEach(iteratee) will not work. Same for map, reduce...

Underscore (or lodash) makes more that just polyfilling es5 methods.