Hey! One of the most straightforward ways is using push()
along with the spread operator. So if you have:
let a = [1, 2];
let b = [3, 4, 5];
a.push(...b);
That’ll update a
in place. Just a heads-up though m if b
is really large, spreading it might hit the call stack limit. So it works great for small to moderate arrays, but not ideal if b
has, say, 100,000+ items.