Tuesday, 3 March 2020

JavaScript finding intersection values from the 2 arrays

function arrayIntersection(ar1, ar2) {
return ar1.filter(function(n) {
return ar2.indexOf(n) !== -1;
});
}

No comments:

Post a Comment