Created
April 4, 2020 03:10
-
-
Save Sonia-Shurmi/c28370c8813fd355dda42f9494edeef4 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
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