How can I create a two dimensional array in JavaScript?

后端 未结 30 4279
天涯浪人
天涯浪人 2020-11-21 05:25

I have been reading online and some places say it isn\'t possible, some say it is and then give an example and others refute the example, etc.

  1. How do I dec

30条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:27

    I found below is the simplest way:

    var array1 = [[]];   
    array1[0][100] = 5; 
    
    alert(array1[0][100]);
    alert(array1.length);
    alert(array1[0].length);
    

提交回复
热议问题