结果:
undefined
0
0
0
/////////////////////
undefined
0
1
2
/////////////////////
undefined
0
1
1
执行代码:
function foo(a, b) {
console.log(b)
return {
foo: function(m) {
return foo(m, a)
}
}
}
const a = foo(0);
a.foo(1)
a.foo(2)
a.foo(3)
const b = foo(0).foo(1).foo(2).foo(3)
const c = foo(0).foo(1);
c.foo(2)
c.foo(3)
🔚 2020-5-26
解析: