Skip to content

Instantly share code, notes, and snippets.

@oHaiyang
Created April 8, 2016 05:16
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