Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by sebhastian.com #
 
PREVIOUS NEXT
Tagged: #javascript #filter #array #multiple #values
ADD COMMENT
Topic
Name
9+1 =