Answers for "simple filter in javascript"

6

filter in js

const filterThisArray = ["a","b","c","d","e"] 
console.log(filterThisArray) // Array(5) [ "a","b","c","d","e" ]

const filteredThatArray = filterThisArray.filter((item) => item!=="e")
console.log(filteredThatArray) // Array(4) [ "a","b","c","d" ]
Posted by: Guest on August-03-2020
1

filter in javascript

const arr = [1, 2, 3, 4, 5, 6];
const filtered = arr.filter(el => el === 2 || el === 4);	//[2, 4]
Posted by: Guest on November-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language