函数内this的指向问题
函数内this的指向问题
1 . 非严格模式下,this指向window
function sum(a , b) { //非严格模式下,this指向window
console.log(this);
return a + b
}
sum();
2. 严格模式下,this指向undefined
function sum(a, b) { //严格模式下,this指向undefined
"use strict";
console.log(this);
return a + b;
}
let c = sum(1,1);
console.log(c);