Skip to content

Instantly share code, notes, and snippets.

@Sonia-Shurmi
Created April 4, 2020 03:10
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 Sonia-Shurmi/c28370c8813fd355dda42f9494edeef4 to your computer and use it in GitHub Desktop.
Save Sonia-Shurmi/c28370c8813fd355dda42f9494edeef4 to your computer and use it in GitHub Desktop.
var num = 99;
var bottle = " bottle ";
var bottles = " bottles ";
while (num >= 1) {
if (num >= 3 ) { // start checking on >=3, lyrics are different in 2 and 1
console.log(num + bottles +"of juice on the wall! " + num + bottles +"of juice! Take one down, pass it around... " + (num - 1) + bottles + "of juice on the wall!");
} else if (num === 2) {
console.log(num + bottles+"of juice on the wall! " + num + bottles+"of juice! Take one down, pass it around... " + (num - 1 ) + bottle + "of juice on the wall!");
} else if (num === 1) {
console.log(num + bottle +"of juice on the wall! " + num + bottle+"of juice! Take one down, pass it around... 0" + bottles + "of juice on the wall!");
}
num--;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment