javascript array filter method example
Example 1: filter javascript array
var words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
console.log(result);
Example 2: array.filter in js
var numbers = [1, 3, 6, 8, 11];
var lucky = numbers.filter(function(number) {
return number > 7;
});
Example 3: js filter array
const filterArray=(a,b)=>{return a.filter((e)=>{return e!=b})}
let array = ["a","b","","d","","f"];
console.log(filterArray(array,""));