Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

filtering in javascript

  //filter numbers divisible by 2 or any other digit using modulo operator; %
  
  const figures = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  const divisibleByTwo = figures.filter((num) => {
    return num % 2 === 0;
  });
  console.log(divisibleByTwo);
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #filtering #javascript
ADD COMMENT
Topic
Name
7+4 =