array filter multiple values in js code example
Example: javascript filter array multiple values
// use .filter and write multiple validations in the callback function
let numbers = [3, 7, 2, 15, 4, 9, 21, 14];
let filteredNumbers = numbers.filter(function (currentElement) {
if (currentElement > 3 && currentElement < 17) {
return true;
}
});
console.log(filteredNumbers);