stuart langridge, 2009
Array functions
[“a”,”b”,”c”].forEach(function(val, idx, arr) {
item (idx) in array (arr) is (val)
});
[1,2,3].every(function(val, idx, arr) {
return (val < 4)
}) // true: see also “some”
[1,2,3,4,5].filter(function(val, idx, arr) {
return (val < 4)
}) // [1,2,3]
[1,2,3,4,5].map(function(val, idx, arr) {
return (val + 6)
}) // [7,8,9,10,11]: see also “reduce”
[“a”,”b”,”c”].indexOf(“b”) // 1