Last active
November 11, 2016 03:48
-
-
Save tqcenglish/743219c15fd84a9c5c8650e22cbf9e1d to your computer and use it in GitHub Desktop.
判断变量 null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 判断变量 undefined | |
var exp = undefined; | |
if (typeof (exp) == "undefined") { | |
alert("undefined"); | |
} | |
// 判断变量 null | |
var exp = null; | |
if (!exp && typeof (exp) != "undefined" && exp != 0) { | |
alert("is null"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment