filter
filter (pure)
Creates an array by filtering the current one, given a filtering function (that returns true if the element should be kept and false if it should be removed).
let arr = [1, 2, 3, 4];
arr.filter((value) => value % 2 === 0);
// => [2, 4]
Backlinks