var arr1 = new Array('2','4','6','8','10'); var arr2 = new Array('6','8'); var arr3 = new Array(); function test(){ alert(arr1.toString()); alert(arr2.toString()); for(var i=0; i < arr1.length; i++){ var flag = true; for(var j=0; j < arr2.length; j++){ if(arr1[i] == arr2[j]) flag = false; } if(flag) arr3.push(arr1[i]); } alert(arr3.toString()); }