Create a single value array in JavaScript

前端 未结 7 599
再見小時候
再見小時候 2021-01-01 08:59

why is the following code showing undefined? Are we not allowed to create an array with a single value? Putting two values won\'t show this error. Is this a pro

相关标签:
7条回答
  • 2021-01-01 09:46

    The above example defining an array called tech with 21 positions. You have to difine it like that

    var tech = new Array('21');
    alert(tech[0]);
    
    0 讨论(0)
提交回复
热议问题