how to get perticular 5 string element out of 10 from array javascript

Solutions on MaxInterview for how to get perticular 5 string element out of 10 from array javascript by the best coders in the world

showing results for - "how to get perticular 5 string element out of 10 from array javascript"
Luana
11 Apr 2018
1const items = ['a', 'b', 'c', 'd', 'e', 'f']
2const valuesToRemove = ['c', 'd']
3const filteredItems = items.filter(item => valuesToRemove.includes(item))
4// ["a", "b", "e", "f"]
5
6console.log(filteredItems)