Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript filter

const myNum = [2,3,4,5,6,7,8,9,10];
//using filter gives us a new array
const divisibleBy3 = myNum.filter(eachNum => eachNum%3==0); 
console.log(divisibleBy3); //output:[3,6,9]
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #javascript #filter
ADD COMMENT
Topic
Name
5+6 =