99 Bottles of Beer on the Wall : Frontend Coding Exercises

Thats some R voodoo magick you got going on there, took me some reading and ChatGPT to figure whats going on…like it :stuck_out_tongue_winking_eye:

The funny thing is I don’t even understand what’s going on anymore.

No more beers for you

1 Like

:hash:Shitfaced_rebase… :laughing:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>99 Bottles of Beer on the Wall</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Architects+Daughter&family=Aref+Ruqaa+Ink:wght@400;700&family=Bagel+Fat+One&family=Chela+One&family=Chilanka&family=Coiny&family=Ewert&family=Gamja+Flower&family=Gloria+Hallelujah&family=Indie+Flower&family=Life+Savers:wght@400;700;800&family=Nosifer&family=Patrick+Hand&family=Quicksand:wght@300;500;700&family=Rubik+Vinyl&family=Yomogi&display=swap" rel="stylesheet">
    <style>
        body {
            background-color: darkcyan;
            color: cyan;
            word-spacing: 5px;
            font-family: 'Architects Daughter', cursive;
            /*
            font-family: 'Chilanka', cursive;
            font-family: 'Gamja Flower', cursive;
            font-family: 'Indie Flower', cursive;
            */
            padding: 2%;
        }
        h1 {
            font-size: 3rem;
            text-shadow: 2px 2px 2px plum;
            letter-spacing: 1px;
            width: 55%;
            border-bottom: 5px double plum;
        }
        h2 {
            font-size: 2.5rem;
            text-shadow: 2px 2px 2px plum;
            letter-spacing: 1px;
        }
        p {
            font-size: 1.5rem;
            font-family: 'Chilanka', cursive;
            line-height: 1.5;
            text-shadow: 2px 2px 2px slateblue;
            width: 60%;
        }
        @media screen and (max-width: 1400px) {
            h1 {
                width: 70%;
            }
        }
        @media screen and (max-width: 1000px) {
            p {
                width: 80%;
            }
        }
        @media screen and (max-width: 800px) {
            h1 {
                width: 90%;
            }
            p {
                width: 100%;
            }
        }
    </style>
</head>
<body>
    <center>
        <h1>99 Bottles of Beer on the Wall</h1>
        <h2>Instructions:</h2>
        <p>Print the entire song of "99 Bottles of Beer on the wall" into the console.  The lyrics go like this:</p>
        <p>"99 Bottles of Beer on the wall, 99 Bottles of beer.  Take one down, pass it around, 98 Bottles of beer on the wall.</p>
        <p>98 Bottles of Beer on the wall, 98 Bottles of beer.  Take one down, pass it around, 97 Bottles of beer on the wall.</p>
        <p>97 Bottles of Beer on the wall, 97 Bottles of beer.  Take one down, pass it around, 96 Bottles of beer on the wall..."</p>
        <p>Keep repeating this until it gets to 1 Bottle (remember to use singular form for "beer").  The song ends like this:</p>
        <p>"...1 bottle of beer on the wall, 1 bottle of beer.  Take one down, pass it around, no more bottles of beer on the wall.</p>
        <p>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."</p>
        <p>...and with this, the song starts over.  But it doesn't have to be repeated in the console; just one loop through the entire song is <i>plenty</i>!</p>
    </center>
    <script>
        for (let i = 99; i > 0; i--) {
            if (i > 1) {
                console.log(`${i} bottles of beer on the wall, ${i} bottles of beer. Take one down, pass it around, ${i-1} bottles of beer on the wall.`);
            } else {
                console.log(`${i} bottle of beer on the wall, ${i} bottle of beer. Take one down, pass it around, no more bottles of beer on the wall.`);
                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.`);
            }
        }
    </script>
</body>
</html>

for (let i = 100; i > 1;i--) {

document.writeln(i + " bottles of beer on the wall, " + i + " bottles of beer.<br> Take one down and pass it around, " +  (i - 1) + " bottles of beer on the wall. <br><br>" );
}

document.writeln("1 bottle of beer on the wall, 1 bottle of beer. <br> Take one down and pass it around, no more bottles of beer on the wall. <br> <br> No more bottles of beer on the wall, no more bottles of beer.<br> Go to the store and buy some more, 99 bottles of beer on the wall.")

thank you so much

You got the badge! :slight_smile: