Skip to content

Instantly share code, notes, and snippets.

@tlwalker
Created April 23, 2013 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlwalker/5445472 to your computer and use it in GitHub Desktop.
Save tlwalker/5445472 to your computer and use it in GitHub Desktop.
Envoy in Javascript - Closure
var withdraw = function (){
var balance = 100;
return function (amount) {
if(amount <= balance){
balance = balance - amount;
} else {
throw new Error('Insufficient funds');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment