const a = [1, 2, 3];
const b = [4, 5, 6];
// 1. .concat()
console.log(a.concat(b)); // [ 1, 2, 3, 4, 5, 6 ]
// 2. spread operator
console.log([...a, ...b]); // [ 1, 2, 3, 4, 5, 6 ]
Thanks for reading π
Follow @codedrops.tech for daily posts.
Instagram β Twitter β Facebook
Micro-Learning β Web Development β Javascript β MERN stack β Javascript
codedrops.tech
Top comments (0)