Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**********第一种,判断null*************** */
- var exp = null;
- if (!exp && typeof(exp)!=”undefined” && exp!=0)
- {
- alert(“is null”);
- }
- typeof exp != "undefined" 排除了 undefined;
- exp != 0 排除了数字零和 false。
- /**********第二种,判断null*************** */
- var exp = null;
- if (exp === null)
- {
- alert("is null");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement