[JavaScript] How to merge three arrays?
I want to merge three arrays, how can we do that in Javascript?
2 Answers
4 years ago by Anusha
You can use either use spread operator or concat operator to merge the arrays like below
Using spread operator
const num4 = [...num1, ...num2, ...num3];
Using Concat
const numbers = num1.concat(num2, num3);
Try running the above solution here https://onecompiler.com/javascript/3xmvzpgy2
4 years ago by Meera
You can use either use spread operator or concat operator to merge the arrays like below
Using spread operator
const num4 = [...num1, ...num2, ...num3];
4 years ago by Rohit gupta