Skip to content

Instantly share code, notes, and snippets.

@tqcenglish
Last active November 11, 2016 03:48
Show Gist options
  • Save tqcenglish/743219c15fd84a9c5c8650e22cbf9e1d to your computer and use it in GitHub Desktop.
Save tqcenglish/743219c15fd84a9c5c8650e22cbf9e1d to your computer and use it in GitHub Desktop.
判断变量 null
// 判断变量 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