var s1 = [1,5,2,6,4,7,9,0]; var s2 = [1,0,6,4,10]; var result = s1.filter(function(value){ return s2.indexOf(value) < 0; }); console.log(result); //result [5, 2, 7, 9]