JS语法_其他
严格模式
let obj = {
name: 'oceans',
}
function f1() {
with (obj) {
console.log(name)
}
}
function f2() {
'use strict'
// try catch无法捕获
with (obj) {
console.log(name)
}
}
f1()
f2()
this 必须被赋值
// log
function f1() {
'use strict'
console.log(this)
}
function f2() {
console.log(this.innerWidth)
}
f1()
f2()