aray.filter code 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: js filter array
const filterArray=(a,b)=>{return a.filter((e)=>{return e!=b})}
let array = ["a","b","","d","","f"];
console.log(filterArray(array,""));
Example 3: filter array js
const arr = ['pine', 'apple', 'pineapple', 'ball', 'roll'];
const longWords = arr.filter(item => item.length > 5);
console.log(longWords);