-
filter()
Src
Thefilter()
method creates a new array with all elements that pass the test implemented by the provided function.
let arr = Array.from(range, num => num * num);
alert(arr); // 1,4,9,16,25
console.log(Array.from('foo'));
// expected output: Array ["f", "o", "o"]
console.log(Array.from([1, 2, 3], x => x + x));
// expected output: Array [2, 4, 6]
-
map()
Apply function to every element, and return a new array for this. -
forEach()
Apply function to every element, but do not return a new array.