javaScript中的 “in”运算符

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

如 “ontouchstart" in document.documentElement;

”onclick“ in document.documentElement;

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

原文地址:https://www.cnblogs.com/sy-liu/p/6839872.html