我正在关注javascript关闭的Mozillas开发者网站,他们有这个代码示例.
function makeAdder(x){
return function (y) {
console.log(y + " this is y")
console.log(x + " this is x")
return x + y;
}
}
var add10 = makeAdder(10);
console.log(add10(2)); // 12
Run Code Online (Sandbox Code Playgroud)
现在我理解正在设置的X属性,但我没有得到的是y的范围如何受到影响.我知道它有一个返回功能,但是当我没有参考时,我的大脑试图想象你如何设置它.有人能解释一下吗
javascript ×1