window、self、frames、this
global、globalThis
self
globalThis
var a = 1;
var b = function() { console.log('fun b中的this:', this) }
c = {};
console.log('this === window', this === window);
console.log('window.a === a:', window.a === a);
b();
console.log('window.c === this.c:', window.c === this.c);
严格模式下:
"use strict";
c = 123;
"use strict";
var b = function() { console.log('fun b中的this:', this) }
b();