Is there a way to concatenate two arrays in JavaScript, where the second array appears before the first?
For example:
const arr1 = [1, 2, 3];
const arr2 = [4, 5, 6];
const combinedArr = arr1.concat(arr2);
console.log(combinedArr);
I am aware that you could simply switch arr1 with arr2 and reverse the order arr2.concat(arr1)
, but I am curious if there is a more efficient or alternative method of achieving this.