Skip to main content

marge common element of to array into one array

function common(arr1, arr2) { debugger; var newArr = []; newArr = arr1.filter(function (v) { return arr2.indexOf(v) >= 0; }) newArr.concat(arr2.filter(function (v) { return newArr.indexOf(v) >= 0; })); return newArr; }

Comments