Skip to content

Instantly share code, notes, and snippets.

@mraiguo
Created October 25, 2020 14:15
Show Gist options
  • Save mraiguo/ab4e592c5fa7cdee87f9ea716b8f618f to your computer and use it in GitHub Desktop.
Save mraiguo/ab4e592c5fa7cdee87f9ea716b8f618f to your computer and use it in GitHub Desktop.
function fun(n,o) {
console.log(o)
return {
fun:function(m){
return fun(m,n);
}
};
}
var a = fun(0); a.fun(1); a.fun(2); a.fun(3);//undefined,?,?,?
var b = fun(0).fun(1).fun(2).fun(3);//undefined,?,?,?
var c = fun(0).fun(1); c.fun(2); c.fun(3);//undefined,?,?,?
//问:三行a,b,c的输出分别是什么?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment