Permalink
Browse files

Merge pull request #1 from cubofantastico/master

submitting homework 1
  • Loading branch information...
vodnik committed Nov 30, 2018
2 parents 4f12eba + a33aacb commit 38b27ce3682e6b445df04ab3a0bb4b1ac3ba32c2
@@ -0,0 +1,92 @@
/*
Write code that prints the lyrics to "99 Bottles of Beer on the Wall" to the
console.
If you're unfamiliar with the song, you can find the lyrics here:
http://www.99-bottles-of-beer.net/lyrics.html.
Be sure that all of your output includes proper spacing (no words or values
running into each other).
Hint: You can make your output appear on multiple lines by using the string \n
to insert a line break.
BONUS: For an extra challenge, improve this code to print "1 bottle" rather
than "1 bottles" as well as the special lyrics for no bottles remaining (Hint:
read up on if/else conditional statements at https://mdn.io/if...else).
*/

// // Problem with bottleCount-1 when we get to one bottle. Still need to figure out how to write 'No bottles of beer on the wall'

/* for (let i = bottleCount; i <= bottleCount && i > 0; i--) {
bottleCount--;
if (bottleCount === 1) {
vessel = ' bottle';
} else {
vessel = ' bottles';
};
console.log(bottleCount + vessel + ' of beer on the wall!\n' + bottleCount + vessel + ' of beer!\nTake one down!\nPass it around!\n' + (bottleCount - 1) + vessel + ' of beer on the wall!');
}; */

//Trying in separate console logs

/*
let bottleCount = 100;
let vessel;
for (let i = bottleCount; i <= bottleCount && i >= 0; i--) {
if (bottleCount === 1) {
vessel = ' bottle';
} else {
vessel = ' bottles';
};
console.log(bottleCount + vessel + ' of beer on the wall!');
console.log(bottleCount + vessel + ' of beer!');
console.log('Take one down!');
console.log('Pass it around!');
console.log((bottleCount - 1) + vessel + ' of beer on the wall!');
bottleCount--;
}; */

let bottleCount = 99;

for (let i = bottleCount; i <= bottleCount && i >= 0; i--) {
if (bottleCount === 2) {
console.log(bottleCount + ' bottles of beer on the wall, ' + bottleCount + ' bottles of beer!\nTake one down, pass it around, ' + (bottleCount-1) + ' bottle of beer on the wall!')
} else if (bottleCount === 1) {
console.log(bottleCount + ' bottle of beer on the wall, ' + bottleCount + ' bottle of beer!\nTake one down, pass it around, no more bottles of beer on the wall!');
} else if (bottleCount === 0) {
console.log('No more bottle of beer on the wall, no more bottles of beer!\nGo to the store, buy some more, 99 bottles of beer on the wall!');
} else {
console.log(bottleCount + ' bottles of beer on the wall, ' + bottleCount + ' bottles of beer!\nTake one down, pass it around, ' + (bottleCount-1) + ' bottles of beer on the wall!');
}
bottleCount--;
};

console.log(
' .===================================================================.' +'\n'+
' || ||' + '\n'+
' || ___ ||' + '\n'+
' || .\' \'. ||' + '\n'+
' || / \\ oOoOo ||' + '\n'+
' || | | ,==||||| ||' + '\n'+
' || \\ / _|| ||||| ||' + '\n'+
' || \'.___.\' _.-\'^|| ||||| ||' + '\n'+
' || __/_______.-\' \'==HHHHH ||' + '\n'+
' || _.-\'` / """"" ||' + '\n'+
' || .-\' / oOoOo ||' + '\n'+
' || `-._ / ,==||||| ||' + '\n'+
' || \'-/._|| ||||| ||' + '\n'+
' || / ^|| ||||| ||' + '\n'+
' || / \'==HHHHH ||' + '\n'+
' || /________\"\"\"\"\" ||' + '\n'+
' || \\ \\ ||' + '\n'+
' || \\ \\ / ||' + '\n'+
' || \\ \\/ ||' + '\n'+
' || / ||' + '\n'+
' || / ||' + '\n'+
' || /_____ ||' + '\n'+
' || ||' + '\n'+
' \'===================================================================\''
)
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<!-- js -->
<script src="app.js"></script>
</body>
</html>

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<ul id="list"></ul>
<!-- js -->
<script src="app.js"></script>
</body>
</html>
Oops, something went wrong.

0 comments on commit 38b27ce

Please sign in to comment.