The forEach method is explained in [4].
The latter example is new in ECMAScript 6 (which should be out already).3
You can test it out in [5].
References
- [1] Mozilla Developer Network - for...of
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
- [2] Stackoverflow - For-each over an array in JavaScript?
- http://stackoverflow.com/questions/9329446/for-each-over-an-array-in-javascript
- [3] ECME-262 6h Edition, The 2015 ECMAScript Language Specification ("Harmony")
- http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts
- [4] forEach
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
- [5] JSFiddle - example in action
- https://jsfiddle.net/maarten_l/8vc44u4b/
No comments:
Post a Comment