Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. /**********第一种,判断null*************** */
  2. var exp = null;
  3. if (!exp && typeof(exp)!=”undefined” && exp!=0)
  4. {
  5. alert(“is null”);
  6. } 
  7.  
  8. typeof exp != "undefined" 排除了 undefined;
  9.  
  10. exp != 0 排除了数字零和 false。
  11.  
  12.  
  13. /**********第二种,判断null*************** */
  14. var exp = null;
  15.  
  16. if (exp === null)
  17.  
  18. {
  19.  
  20. alert("is null");
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement