Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Difference between elements of two arrays js

////Difference b/w elements of two arrays
const a = [1, 2, 3, 4, 5];
const b = [1, 2];

var difference = a.filter((x) => !b.includes(x));
console.log(difference);
//[3,4,5]
Source by techiedelight.com #
 
PREVIOUS NEXT
Tagged: #Difference #elements #arrays #js
ADD COMMENT
Topic
Name
4+4 =