filter function javascript array top 10 code example
Example 1: javascript array filter elements greater than
function isGreater(element, index, array) {
return (element >= 10);
}
let testElemets = [12, 5, 8, 130, 44].filter(isGreater);
console.log("Test Value : " + testElemets );
Example 2: filter out arrays js
let newArray = array.filter(function(item) {
return condition;
});