Created
April 8, 2016 05:16
This file contains hidden or 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