js判斷undefined類型

http://www.cnblogs.com/binaryworms/archive/2010/04/08/1707064.html

點擊打開鏈接


js判斷undefined類型

    if (reValue== undefined){
    alert("undefined");
    }
  發現判斷不出來,最後查了下資料要用typeof
方法:
if (typeof(reValue) == "undefined") { 
   alert("undefined"); 
}  

typeof 返回的是字符串,有六種可能:"number"、"string"、"boolean"、"object"、"function"、"undefined"


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章