<p>js判断undefined类型</p><pre class="brush:js;toolbar:false">if(reValue==undefined){ alert(&quot;undefined&quot;); }</pre><p> 发现判断不出来,最后查了下资料要用typeof</p><p>方法:</p><pre class="brush:js;toolbar:false">if(typeof(reValue)==&quot;undefined&quot;){ alert(&quot;undefined&quot;); }</pre><p>typeof 返回的是字符串,有六种可能:&quot;number&quot;、&quot;string&quot;、&quot;boolean&quot;、&quot;object&quot;、&quot;function&quot;、&quot;undefined&quot;</p>
返回顶部 留言