.concat() method
1) function of .concat() method
a) Return a new Array (merged)
b) Doesn't change the existing array
// .concat() method returns a new Array(Merged)
// Doesn't change the existing Array
// 0 1 2 3 4
const a = ['a', 'b', 'c', '10', 'd'];
const b = ['10', '20', '30'];
const newArray1 = a.concat(b);
const newArray2 = b.concat(a);
console.log(newArray1);
console.log(newArray2);
console.log(a); // this will remain as it is.
console.log(b); // this will remain as it is too.
==========================================================================================
TERMINAL:

Comments
Post a Comment