JavaScript

JavaScript Tip (1) - saving array into another array

SOJA_Dev 2022. 10. 30. 14:33

When you want to save an array into another array

wrong example code
wrong example result

Arrays in another array will become same as above.

But there's a real simple way to fix it with array.flat([])

Let's give it a try.

Correct example code

if you exchange push array as above

correct example result

You can see the correct form!