-
-
Save JosephPecoraro/3894 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 make_adder( left_operand ) { | |
return function ( right_operand ) { | |
return left_operand + right_operand; | |
}; | |
} | |
// so, you can say: | |
var plus_two = make_adder(2); | |
var plus_three = make_adder(3); | |
alert(plus_two(5)); //=> 7 | |
alert(plus_three(5)); //=> 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment