Advertisement
setu

99 Bottles Lyrics JavaScript

Sep 8th, 2019
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 99 Bottles Lyrics Practice by Saidur Rahman Setu (@srsetu)
  2.  
  3. var n = 99;
  4.  
  5. function beer() {
  6.     while( n >= 0) {
  7.       if ( n > 1) {
  8.           console.log(n + " bottles of beer on the wall, " + n + " bottles of beer. Take one down and pass it around, "+ (n - 1) +" bottles of beer on the wall.");
  9.       }  
  10.       else if ( n ===  1) {
  11.          console.log("1 bottle of beer on the wall, 1 bottle of beer. Take one down and pass it around, no more bottles of beer on the wall.");
  12.       }
  13.       else if (n === 0) {
  14.           console.log("No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.");
  15.       }
  16.       n--;
  17.     };
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement