Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

filter in javascript

const arr = [1, 2, 3, 4, 5, 6];
const filtered = arr.filter(el => el === 2 || el === 4);	//[2, 4]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #filter #javascript
ADD COMMENT
Topic
Name
6+2 =