Skip to content

Instantly share code, notes, and snippets.

@ceci21
Last active August 19, 2017 19:05
Show Gist options
  • Save ceci21/f29f58995a8eee0a631d59a9420dc1d9 to your computer and use it in GitHub Desktop.
Save ceci21/f29f58995a8eee0a631d59a9420dc1d9 to your computer and use it in GitHub Desktop.
function displayBeers() {
var counter = 99;
return function() {
if (counter === 0) {
console.log("No more!");
}
console.log(counter + " bottles of beer on the wall\n" + counter + " bottles of beer\nTake one down and pass it around\n" + (counter - 1) + " bottles of beer on the wall\n");
counter = counter - 1;
}
}
var beerVerse = displayBeers();
beerVerse()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment