Author: Mensah Alkebu-Lan
Table of Contents #
Some familiarity with arrow functions.
Below is a typical example of how the filter function is used:
var arr1 = [1,2,3,4],
arr2 = [2,4],
res = arr1.filter(item => !arr2.includes(item));
When this program is executed, the result should be [1,3]. That is, for each of the elements in arr1, the provider function is going to check whether the array [2,4] includes that item. If the element is neither 2 nor 4, it will be added to the filtered array.