1.为啥要先判断obj!=null2.为什么要obj===obj.window;而不是ojb===window;我这样写不也可以判断
isWindow:function(obj){ return obj===window; }
因为 obj 有可能为 null 或者 undefined,要先确定 obj 存在才能去判断 obj.window 是否与 obj 相等
至于为什么要用 obj === obj.window 判断你可以参考 https://developer.mozilla.org...
2.1m questions
2.1m answers
63 comments
56.6k users