Home>

When adding the read data to the 2D array
Unexpectedly, push could not be used.

Here is a sample.

function runA ()
{
    var arW = new Array ();
    var i;
    for (i = 0;i<4;i ++)
    {
        arW [i] = new Array ();
    }
    arW [0] = document.getElementById ("data01"). value;
    document.getElementById ("out01"). innerHTML = arW [0];
    arW [0] .push (666);
    document.getElementById ("out02"). innerHTML = arW [0];
}


When I run this code

The first output shows the array contents normally,
If i push the second line from the bottom

Uncaught TypeError: arW [0] .push is not a function

I get an error message like this.

Question

In a two-dimensional array, a large amount of data is separately stored for each array in the first dimension.
Can you tell me how to add it?