Copy the code code as follows:
var a = [ "a" , "b" , "c" ],
b = [ "b" , "c" , "d" ],
c = [ "c" , "d" , "e" ],
_a = a.concat( b ).concat( c ),
_hash = {},
_new = [];
for( var i = _a.length; i--; ){
if( !_hash[ _a[ i ] ] ){
_hash[ _a[ i ] ] = 1;
_new.push( _a[ i ] );
};
};
return _new;
Idea: First use concat to splice arrays, and then use an object and a new array (used to store non-duplicate arrays).
Traverse the old array and put the values into the object. If the values are different, they are put into the new array. If the values are repeated, they are not placed.