Goodspeed

导航

2014年1月26日 #

JS中的各种检测

摘要: 1 //null 只在肯定返回null值时才使用null比较 2 var element = document.getElementById("my-div"); 3 if (element === null) { 4 5 }; 6 //string number boolean undefined 7 var num = 123; 8 if (typeof num === "number") { 9 10 };11 12 /*13 检查引用值14 Date RegExp Error15 跨域的检查会有问题16 */17 if (value instan 阅读全文

posted @ 2014-01-26 11:08 Goodspeed 阅读(428) 评论(0) 推荐(0) 编辑