what is the use of filter function in javascript code example
Example 1: filter out arrays js
let newArray = array.filter(function(item) {
return condition;
});
Example 2: array.filter in js
var numbers = [1, 3, 6, 8, 11];
var lucky = numbers.filter(function(number) {
return number > 7;
});