Created
April 8, 2016 05:16
-
-
Save oHaiyang/c25705f683bcabfc18d9d1cd26126a54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wrapValue(n) { | |
return function() { | |
return n += 2; | |
}; | |
} | |
var wrap1 = wrapValue(1); | |
console.log(wrap1()); //-> 1 | |
console.log(wrap1()); | |
//为什么每被多执行一次,wrap1()的返回值就会增大呢? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment