var a = ['a','b','c']; var b = ['d','e','a','b','c']; for (var i = 0; i < a.length; i++) { for (var j = 0; j < b.length; j++) { if (a[i] == b[j]) { b.splice(j,1); } } } b;//'d','e'