DEV Community

Clever Cottonmouth
Clever Cottonmouth

Posted on

concatenate array using apply

let arr1 = [1,2,3]
let arr2 = [4,5,6]

arr1.push.apply(arr1,arr2)

console.log(arr1)

Top comments (1)

Collapse
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

Why not just:

arr1.push(...arr2)
Enter fullscreen mode Exit fullscreen mode

?