Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript filter method

const grades = [10, 2, 21, 35, 50, -10, 0, 1];

// get all grades > 20
const result = grades.filter(grade => grade > 20); // [21, 35, 50];

// get all grades > 30
grades.filter(grade => grade > 30); // [35, 50]
Source by react-tutorial.app #
 
PREVIOUS NEXT
Tagged: #JavaScript #filter #method
ADD COMMENT
Topic
Name
2+5 =