Introduction to Array.filter
Premium
filter() returns a new array that contains only the elements that pass a test. It's the natural counterpart to map(): map transforms every element, filter keeps a subset.
filter() returns a new array that contains only the elements that pass a test. It's the natural counterpart to map(): map transforms every element, filter keeps a subset.