我正在研究Mozilla tutorial on JavaScript, "Nested functions and closures"。
我有这个功能:
function outside(x){
function inside(y){
return x + y;
}
return inside;
}
这应该返回8:
fn_inside = outside(3);
result = fn_inside(5);
result1 = outside(3)(5);
console.log(result);
但它返回10 - 为什么会这样?