JavaScript array filter method
The filter() method creates a new array and populates that array with all the elements that meet the condition specified in a callback function. Syntax : array.filter(callbackFunction[, thisArg]) Parameters callbackFunction Required. Function that gets called for each element of the array. If the function returns true, the element is kept otherwise filtered. thisArg Optional. An object to which the this keyword can refer in the callbackfn function. The filter method calls the callbackfn function one time for each element in the array. If the callback function returns false for all elements of the array, the length of the new array that will be returned is 0. Callback Function Syntax function callbackFunction(value, index, array) Callback Function Parameters value The value of the element in the array index The index position of the element in the array array