Answers for "common elements between multiple arrays js"

15

javascript difference between two arrays

let difference = arr1.filter(x => !arr2.includes(x));
Posted by: Guest on April-03-2020
1

how to add multiple elements to A new array javascript

let vegetables = ['parsnip', 'potato']
let moreVegs = ['celery', 'beetroot']

// Merge the second array into the first one
// Equivalent to vegetables.push('celery', 'beetroot')
Array.prototype.push.apply(vegetables, moreVegs)

console.log(vegetables)  // ['parsnip', 'potato', 'celery', 'beetroot']
Posted by: Guest on November-02-2020

Code answers related to "common elements between multiple arrays js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language