久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      undefined與null有什么區(qū)別

      undefined與null有什么區(qū)別

      首先我們知道undefined與null都屬于 JavaScript 的 7 種基本類型。

      (推薦教程:js教程)

       let primitiveTypes = ['string','number','null','undefined','boolean','symbol', 'bigint'];

      它們是屬于虛值,可以使用Boolean(value)或!!value將其轉(zhuǎn)換為布爾值時,值為false。

      console.log(!!null); // false console.log(!!undefined); // false console.log(Boolean(null)); // false console.log(Boolean(undefined)); // false

      區(qū)別:

      undefined是未指定特定值的變量的默認值,或者沒有顯式返回值的函數(shù),如:console.log(1),還包括對象中不存在的屬性,這些 JS 引擎都會為其分配 undefined 值。

      undefined與null有什么區(qū)別

      null是“不代表任何值的值”。 null是已明確定義給變量的值。 在此示例中,當(dāng)fs.readFile方法未引發(fā)錯誤時,我們將獲得null值。

      undefined與null有什么區(qū)別

      在比較null和undefined時,我們使用==時得到true,使用===時得到false。

       console.log(null == undefined); // true   console.log(null === undefined); // false

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