Best Solution.The best solution...
youYou can check directly in the browser Consoleconsole by hitting...
Without Duplicate###Without duplicate
a = [1, 2, 3];
b = [3, 2, 1, "prince"];
a.concat(b.filter(function(el) {
return a.indexOf(el) === -1;
}));
With Duplicate###With duplicate
["prince", "asish", 5].concat(["ravi", 4])
ifIf you Want Without Duplicatewant without duplicate you can try a better Sol.solution from here - Shouting Code.
[1, 2, 3].concat([3, 2, 1, "prince"].filter(function(el) {
return [1, 2, 3].indexOf(el) === -1;
}));
Try Onon Chrome Browser Consolebrowser console
f12 > console
OutPutOutput:
["prince", "asish", 5, "ravi", 4]
[1, 2, 3, "prince"]