久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      JavaScript怎么創(chuàng)建空數(shù)組

      JavaScript創(chuàng)建空數(shù)組的方法:1、利用數(shù)組直接量“[]”,語(yǔ)法“var 數(shù)組名=[];”;2、利用Array()函數(shù),語(yǔ)法“var 數(shù)組名=new Array();”或“var 數(shù)組名=new Array(數(shù)組長(zhǎng)度值);”。

      JavaScript怎么創(chuàng)建空數(shù)組

      本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

      方法1:利用數(shù)組直接量“[]

      數(shù)組直接量的語(yǔ)法格式:在中括號(hào)中包含多個(gè)值列表,值之間用逗號(hào)分隔。

      var 數(shù)組名=[值列表];

      如果值列表為空,則可創(chuàng)建一個(gè)空數(shù)組。

      var arr = [];  //空數(shù)組 console.log(arr);

      JavaScript怎么創(chuàng)建空數(shù)組

      方法2:利用Array()函數(shù)

      使用 new 運(yùn)算符調(diào)用 Array() 類型函數(shù)時(shí),可以構(gòu)造一個(gè)新數(shù)組。

      var 數(shù)組名 = new Array(值列表);

      同樣如果值列表為空,則可創(chuàng)建一個(gè)空數(shù)組。

      var arr = new Array();   console.log(arr);

      JavaScript怎么創(chuàng)建空數(shù)組

      如果給Array()傳遞一個(gè)數(shù)值參數(shù),則該參數(shù)值等于數(shù)組 length 的屬性值,可以定義數(shù)組的長(zhǎng)度,即包含元素的個(gè)數(shù)。

      var arr = new Array(5);  //有指定長(zhǎng)度的空數(shù)組 console.log(arr);

      JavaScript怎么創(chuàng)建空數(shù)組

      【推薦學(xué)習(xí):javascript高級(jí)教程】

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)