filter elements from array code example
Example 1: filter in js
const filterThisArray = ["a","b","c","d","e"]
console.log(filterThisArray)
const filteredThatArray = filterThisArray.filter((item) => item!=="e")
console.log(filteredThatArray)
Example 2: array filter
const words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
const result = words.filter(word => word.length > 6);
console.log(result);
Example 3: javascript array filter
var newArray = array.filter(function(item) {
return condition;
});
Example 4: js filter items by index
let newArray = arr.filter(callback(element[, index, [array]])[, thisArg])