Hi Friends 👋,
Welcome To Infinitbility! ❤️
concat() method to merge two arrays.
The concat() method is used to merge two or more arrays. This method does not change the existing arrays but instead returns a new array.
So, here we will create two sample arrays like the below example, after that, we will use
concat() method to append one array to another, and store it in the third array variable.
// create sample arrays const arr1 = ['a', 'b', 'c']; const arr2 = ['d', 'e', 'f']; // apend array const arr3 = arr1.concat(arr2); console.log(arr3);
when you run the above code, it will concat both array and print in your console.
let’s check the output.
I hope it’s help you, All the best 👍.