javascript如何判断一个对象是否是窗口
<!DOCTYPE html> <html> <head> </head> <body> <script type="text/javascript"> function isWindow( obj ) { /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }; function test(){ console.log(this); console.log(this.window); console.log(isWindow(this)); } test(); </script> </body> </html>