Answers for "return elements of an array from another array javascript"

0

return elements of an array from another array javascript

var toBeFiltered = [1,2,3,4,5,6];
var elements = [6,3,2];
var filteredElements = toBeFiltered.filter(
    function(e) {
        return this.indexOf(e) >= 0;
    },
    elements
);

console.log(toBeFiltered);
console.log(elements);
console.log(filteredElements);
Posted by: Guest on June-07-2021

Code answers related to "return elements of an array from another array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language