javaScript中的 “in”运算符

javaScript中的in运算符 检查某个对象是否具有给定名称的属性(直接或动过对象的原型),可能返回 true, false、0 、“” 等;

如 “ontouchstart" in document.documentElement;

”onclick“ in document.documentElement;

in 不需要提取属性的值,只需检查他是否存在。

posted @ 2017-05-11 10:58  三里路异乡客  阅读(263)  评论(0)    收藏  举报