To create a double Array
in JavaScript, you can use the Array.from()
method or the spread operator. Here's an example using the Array.from()
method:
index.tsx96 chars4 lines
The above code creates an Array
of length 2
and fills each element with a new empty Array
.
Alternatively, you can use the spread operator to create the double Array
:
index.tsx74 chars4 lines
Here, we're creating a new empty Array
and then using the spread operator to create a second element which is also an empty Array
.
gistlibby LogSnag