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

      小程序前臺怎么判斷是空白消息

      小程序前臺怎么判斷是空白消息

      小程序前臺怎么判斷是空白消息

      方法:可以封裝個判斷對象為空的函數(shù),如下面代碼中isBlank。

      function isBlank(str){   if (Object.prototype.toString.call(str) ==='[object Undefined]'){//空     return true   } else if (     Object.prototype.toString.call(str) === '[object String]' ||      Object.prototype.toString.call(str) === '[object Array]') { //字條串或數(shù)組     return str.length==0?true:false   } else if (Object.prototype.toString.call(str) === '[object Object]') {     return JSON.stringify(str)=='{}'?true:false   }else{     return true   } }

      使用isBlank對消息進(jìn)行為空判斷:

      if(isBlank(message)){     console.log('消息為空') }else{     console.log('消息:' + message) }

      PHP中文網(wǎng),大量免費小程序開發(fā)教程,歡迎學(xué)習(xí)!

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