JSFiddle - React, Tailwind, and code Playground

by Alexander

JavaScript

console.clear();

let a = [1,2,3,4];
let b = [3,4,5,6];
var c;

//c = [...a, ...b];
//c = a,a.push(...b);

//c = a.concat(b);
//c = [].concat(a, b);

//c = a,Array.prototype.push.apply(a, b);
//c = a,a.push.apply(a, b);
//c = b,b.unshift.apply(b, a);

//c = b.reduce((a,b)=>(a.push(b),a),a);
//c = a.reduceRight((a,b)=>(a.unshift(b),a),b);

//for (var c=a, i=0; i < b.length; i++) a.push(b[i]);
//for (var c=b,i=b.length; i --> 0;) b.unshift(a[i]);

//c = a.concat(b.filter(i=>a.indexOf(i)===-1));
//c = new Set([...a, ...b]);
//c = [ ...new Set([...a,...b]) ];

//c = Array.from(new Set(a.concat(b)));
c = Array.of(...new Set(Array.of(...a, ...b)));

console.log(Array.isArray(c));
console.log(c);