久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      javascript怎么判斷是否為對象

      判斷方法:1、使用toString()來判斷;2、使用“obj.constructor === Object”來判斷;3、使用“ypeof obj === Object”來判斷;4、利用instanceof關(guān)鍵字來判斷。

      javascript怎么判斷是否為對象

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

      1、toString() 第一選擇

      let obj = {} Object.prototype.toString.call(obj) === '[Object Object]'

      2、constructor

      let obj = {} obj.constructor === Object

      【推薦學(xué)習(xí):js基礎(chǔ)教程】

      3、instanceof

      注意:使用instanceof對數(shù)組進(jìn)行判斷也是對象

      let obj = {} obj instanceof Object  //true let arr = [] arr instanceof Object  //true

      4、typeof

      let obj = {} typeof obj === Object // 根據(jù)typeof判斷對象也不太準(zhǔn)確 表達(dá)式                       返回值 typeof undefined           'undefined' typeof null                'object' typeof true                'boolean' typeof 123                 'number' typeof "abc"               'string' typeof function() {}       'function' typeof {}                  'object' typeof []                  'object'

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