Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Extra Credit (Are there points for submitting these)? Javascript Loop Structure - Fizz Buzz

Here's my looping test for the javascript fizzbuzz.

for (i=1; i <= 100; i++) { if (i%15==0) { console.log("fizzbuzz"); } else if (i%3==0) { console.log("fizz"); } else if (i%5==0) { console.log("buzz"); } else { console.log(i); } }

Not sure if you can get any 'check marks' for these or they're just personal tests.

(You have to test 15 first to make it work properly. )

3 Answers

huckleberry
huckleberry
14,636 Points

Nope, no points bro. They're just there to give you something to practice.

That's a great solution though using the if (i%15 === 0) though. I hadn't thought of that when I first did it. I only used the && operator. i.e. if (i % 5 === 0 && i % 3 === 0). Good stuff :).

For further practice you can check out other sites that offer well known coding challenges for practice.

One such site is coderbyte. It's pretty cool. It gives you a whole host of challenges and you can track your progress and gain points and all.

another is HackerRank which provides a ton of challenges as well as a community, badges, leaderboards and even possible job opportunities as they make the leaderboard and challenge stats available to employers out there looking for those hidden gems out in the coding world.

There are others but geeze that's enough right? If you just want a list of good coding challenges without all the fluff(but since you were asking about points I'm guessing you'll like the first 2) this here is a popular repository of classic challenges/projects that apply to most any language for programmers to hone their skills with as well as solutions that have been submitted by folks out there that have solved them so the solutions include solutions in a lot of languages (although some projects only have one or two language solutions that have been submitted)

Enjoy!!

Thanks for the input. Saw other people posting their code so I wasn't sure.

I had been through the fizzbuzz thing before in other programming attempts, it's a standard test. Ideally you could do it with a switch (case) statment but javascripts functionality doesn't really allow it.

CodeWars is a good site as well. There was also something whose name I forget that presents a bunch of questions that you have to use code to get the answer...like what is the 1000th prime number (hint don't scroll through all numbers, your computer will take forever ;)

huckleberry
huckleberry
14,636 Points

Thanks for the input. Saw other people posting their code so I wasn't sure.

Np at all. Oh for future reference, to make the code look like code, if you didn't know, you wrapp it in 3 backticks in the beginning and then close it with 3 backticks at the end.

And type the name of the language after the first 3 backticks.

I had been through the fizzbuzz thing before in other programming attempts, it's a standard test. Ideally you could do it with a switch (case) statment but javascripts functionality doesn't really allow it.

ohhh ... so you're old hat then :wink:. I'm all new to the actual programming and pretty far removed from school so I saw your solution and went "Brilliant! A savant I tells ya!" lol...

And ya lost me on the 2nd part there... dunno switch(case) so for right now it just sounds like a bad experience at the airport.

CodeWars is a good site as well. There was also something whose name I forget that presents a bunch of questions that you have to use code to get the answer...like what is the 1000th prime number (hint don't scroll through all numbers, your computer will take forever ;)

That does look promising. Looked really cool till I saw that you had to test your skills first to prove worthiness. Maybe in a couple of months I can go back and try... wouldn't want the application process to gain sentience and begin laughing at me lol

Cheers,

As for case/switch statements - if there's javascript stuff you want to learn that isn't covered here - i'd start with w3 schools brief listing of the various available commands and control structures for javascript.

They're pretty quick and have 'try it' function that allows you to experiment with the specific code.

In general a switch/case statement allows you to run 'multiple' if's on a variable without all that crazy (and hard to read) nesting. You shouldn't really nest if's too deeply (even with else and else if) unless you really have to. Switch/case statements are a good alternative when you are expecting multiple SPECIFIC outcomes (and in javascript when you don't have to do any comparison or anything, just test the variable for a specific value)

They also allow for a default value in case all conditions fail.

They're just useful for cleaner (and easier to write) code so you don't get lost in too much deep nesting.

huckleberry
huckleberry
14,636 Points

oooh that sounds fantastic! I did my own side project for the madlibs exercise and I decided to make a different alert message for every possible right and wrong answer and it worked and I was very pleased but omg the nesting... it was so confusing trying to test and debug the thing.

Sounds like switch would've made it a whole lot easier lol...

Here's the code if you're interested in seeing what a mess of if/else soup I came up with. Be kind lol

edit: nevermind, can't get it to format correctly... edit2: was able to post it in its own comment. Dunno what I was doing wrong...

Thanks for the tip!

huckleberry
huckleberry
14,636 Points

Trying again...

//FINAL CONDITIONAL CODE CHALLENGE
//BUILD A MULTIPLE CHOICE QUIZ APP
//SPECIFICATIONS
//1. MUST HAVE AT LEAST 5 QUESTIONS
//2. KEEP TRACK OF THE NUMBER OF QUESTIONS THE USER HAS ANSWERED CORRECTLY
//3. PROVIDE A FINAL MESSAGE AFTER THE QUIZ LETTING THE USER KNOW HOW MANY THEY ANSWERED CORRECTLY
//4. RANK THE PLAYER.  IF THEY ANSWERED ALL 5 QUESTIONS CORRECTLY THEY GET A GOLD CROWN. 3-4 IS A SILVER CROWN. 1-2 IS THE BRONZE CROWN AND 0 IS NO CROWN.

 //FIRST GENERATE 5 QUESTIONS ******
 //ASSIGN THEM TO VARIABLES (I'M GUESSING THAT LATER ON WE WOULD USE AN ARRAY?)*****
 //PROVIDE A PROMPT TO ASK THE USER IF THEY WOULD LIKE TO TAKE THE QUIZ****
 //IF YES COMMENCE THE QUIZ. IF NO,  GOODBYE. 


 var question1 = "Who wrote Pet Cemetary?";
 var question2 = "What color eyes are all kittens born with?";
 var question3 = "True or False: HTML is an object oriented programming language?";
 var question4 = "What is the abbreviation for the interbank foreign currency exchange market?";
 var question5 = "What company makes the Corvette?";
 var answer1 = "Stephen King";
 var answer2 = "Blue";
 var answer3 = "False";
 var answer4 = "FOREX";
 var answer5 = "Chevrolet";
 var answer5a = "Chevy";

var userName = prompt("Hello! What's your name?");
var commence = prompt("Hello, " + userName + "!" + " Would you like to see how smart you are?");

var correct = 0;

if (commence.toUpperCase() === 'YES' || commence.toUpperCase() === 'Y' || commence.toUpperCase() === 'SURE') {
    alert("Excellent! Let's continue, shall we?");
    var userAnswer1 = prompt(question1);
    if (userAnswer1.toUpperCase() === answer1.toUpperCase()){
        correct += 1;
        alert("Fantastic! What a way to start! Click ok to continue.");
        var userAnswer2 = prompt(question2);
        if (userAnswer2.toUpperCase() === answer2.toUpperCase()){
            correct += 1;
            alert("Correctamundo!! One more and that's a turkey! Click ok to continue.");
            var userAnswer3 = prompt(question3);
            if (userAnswer3.toUpperCase() === answer3.toUpperCase()){
                correct += 1;
                alert("You are on fire my friend!! Click OK to continue!");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("This is amazing! We've never seen anything like it!! Click OK to continue! (And good luck!)");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("OUTSTANDING!! IT'S UNPRECEDENTED! IT'S EXTRAORDINARY! IT'S ... ")
                        alert("Meh... let's face it. It's nothing to get excited about. They were dumb questions that indicate no real intelligence or aptitude. You're probably just as dumb as the rest of the people coming through here.");
                        alert("Enjoy your mediocrity, Mr. Gold Crown.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("OMG YOU MUST HATE YOURSELF SO MUCH RIGHT NOW... ")
                        alert("THE GOLD... WITHIN REACH AND YOU CHOKED!! HAHAHAHAHAHA!");
                        alert("Enjoy your mediocrity, Mr. NO GOLD... EVER.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    } 
                    }
                } else {
                    alert("Ohhh man, that's gotta hurt. Oh well my friend, let's finish strong!!");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("YES!... 80%, fantastic! You've got the silver and congratulations for 2nd place!!")
                        alert("Said no one. Ever.");
                        alert("You ridiculous failure... to come so close to the gold. Tsk tsk. Now go call your mother and disappoint her.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("You choked. 60% is your result.")
                        alert("That's a janitorial job for you my friend.");
                        alert("How did you not know that last one though? Seriously... ");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }       
                }
            } else {
                alert("Awww, there goes your streak. Sorry but you can still hit 4 out of 5. Let's go!");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("See, that last one was just a small slip up. Hit ok to continue!");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Good man. One small error and ya finished strong. You kept your head about you and that's admirable. You're one smart, tough cookie.")
                        alert("That just wasted your time on a corny game about useless facts for a fake crown.");
                        alert("Not so smart after all, are ya?");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }else {
                        alert("Bah... you lost it. Had it and then gone.")
                        alert("Bronze for you... ");
                        alert("Middle of the road is the best you can hope for I suppose.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                } else {
                    alert("LOL... you fool.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("*APPLAUSE* ... lol no. Not really");
                        alert("That was turd level performance. Truly.");
                        alert("Buuut I expected as much with a name like " + userName + ".");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }


                    }else {
                        alert("OH WHAT THE HECK MAN??");
                        alert("I HAD 30 BITCOINS RIDING ON YOU WITH THE PROMPT/ALERT TEAM FROM REDDIT... JEEEEEZ MAN... ");
                        alert("I'M TAKING IT FROM YOUR PAYPAL. I CAN DO THAT YOU KNOW!!");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }
                } 
            }

        }else {
            alert("Ok, batting 500. That's not bad. Everyone can make a mistake. Click OK to continue.");
            var userAnswer3 = prompt(question3);
            if (userAnswer3.toUpperCase() === answer3.toUpperCase()){
                correct += 1;
                alert("Back on track! Click OK to move forward.");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("Sweeet ... knockin it out of the park now. Click OK.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Theeeere we go. What a strong finish! Stupendous! Fabulous!");
                        alert("Now here's your worthless silver internet crown. Go be useful now or something.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    } else {
                        alert("All that cheering you on and for what? ");
                        alert("I don't even know why I bother anymore.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                } else {
                    alert("Doh! Click to continue if you're really willing to find out if you have what it takes.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Theeeere we go. What a strong finish! Stupendous! Fabulous!");
                        alert("Now here's your worthless silver internet crown. Go be useful now or something.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    } else {
                        alert("All that cheering you on and for what? ");
                        alert("I don't even know why I bother anymore.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }

                }
            } else {
                alert("Aaand down to .333. Thing you can recover?");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("Alright, little better. What else ya got?");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("You picked up the slack. Good on ya!");
                        alert("If picking up the slack mattered.");
                        alert("Next time don't slack. Slacker.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    } else {
                        alert("What a waste.");
                        alert("Fail. Not an epic fail. But a fail.");
                        alert("I'm sure nothing that could be described as epic has ever been used in the same sentence as you so hey, par for the course, amirite?");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }
                } else {
                    alert("NOOOPE lol... kind of figured though. Click ok, tard.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Blah blah congrats on being bottom of the barrell.");
                        alert("Did you pick up on the snottiness of that?");
                        alert("Or does your stupidity extend to basic communications as well?");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    } else {
                        alert("LOL nope... ");
                        alert("Disgraceful.");
                        alert("Your parents tell people you were adopted, don't they? I would.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }
                }

            }
        }
    } else {
        alert("Ooooo... not a great way to get started. Click ok to continue if you want.");
        var userAnswer2 = prompt(question2);
        if (userAnswer2.toUpperCase() === answer2.toUpperCase()){
            correct += 1;
            alert("That's better! Let's see if we can't keep that up? Click ok to continue.");
            var userAnswer3 = prompt(question3);
            if (userAnswer3.toUpperCase() === answer3.toUpperCase()){
                correct += 1;
                alert("There we go! Can we get a turkey now? Click OK to continue!");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("TURKEY!! let's go for the silver! Click OK to continue! (And good luck!)");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Brilliant recovery! It's astounding! Magnifico!! It's truley one of the greatest comebacks I've ever seen... frankly, it's ... ")
                        alert("Meh... let's face it. It's nothing to get excited about. They were dumb questions that indicate no real intelligence or aptitude. You're probably just as dumb as the rest of the people coming through here.");
                        alert("Enjoy your mediocrity, Mr. Cinco Crown.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("Not bad, not bad at all.")
                        alert("If your goal was disappointment.");
                        alert("Go on, get out of here.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                } else {
                    alert("NO TURKEY FOR YOU!");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("OK, you recovered somewhat...")
                        alert("Still pretty unforgettable though.");
                        alert("Bet my grandmother could've beaten that score.");
                    } else {
                        alert("lol you're atrocious.")
                        alert("Go read a newspaper or something... jeez.");
                        alert("Like... now. Go.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }

                }
            } else {
                alert("Son of a... just a hit and a miss kind of person aint ya?");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert('yay, another "one" right.');
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Brilliant recovery! It's astounding! Magnifico!! It's truley one of the greatest comebacks I've ever seen... frankly, it's ... ")
                        alert("Meh... let's face it. It's nothing to get excited about. They were dumb questions that indicate no real intelligence or aptitude. You're probably just as dumb as the rest of the people coming through here.");
                        alert("Enjoy your mediocrity, Mr. Cinco Crown.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("Not bad, not bad at all.")
                        alert("If your goal was disappointment.");
                        alert("Go on, get out of here.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                }else {
                    alert('Just gonna bomb the whole thing from here on out aint ya?');
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("hey hey, alright! Good job!")
                        alert("Just kidding. Your performance was abysmal");
                        alert("A whopping " + correct + " answers correct. Whoooopdie dooo!");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("What's wrong with you?")
                        alert("Are you drunk, high or just that uninformed about the world around you?");
                        alert("I'm ashamed I ever thought anything of worth about you.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }
                }   

            }
        } else {
            alert("Really? Two questions in and not a single hit, huh? Maybe you're just tired... click OK to continue if you think you're up to it.");
            var userAnswer3 = prompt(question3);
            if (userAnswer3.toUpperCase() === answer3.toUpperCase()){
                correct += 1;
                alert("Ok, well, better late than never I suppose. Click OK to continue!");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("Maybe there's hope for you yet... click Ok. ");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Three aint all bad...eh? so congratulations!")
                        alert("For being average...");
                        alert("Here's your silver crown... and there's your cubicle, Mr. not good enough for the gold.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("Two aint all bad...eh? so congratulations!")
                        alert("I'm soooo kidding. You're just terrible. My old friend Buddy could've gotten at least three.");
                        alert("And he's a dog.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                } else {
                    alert("Never have I seen such wishy washy performance. Click OK to continue.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("Two is all you can hope for I suppose.")
                        alert("From the looks of you, that's probably all I should have expected.");
                        alert("Check your score. Feel that hollow pit of disappointment in your stomach and then leave knowing that this was indeed your 'best'.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("Wow... 1.")
                        alert("1...");
                        alert("That's out of 5 dude. I'd ask you if you knew what % that is but you wouldn't know that either, would you?");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    }


                }
            } else {
                alert("Pfft... were your parents brother and sister?? I don't know why you would bother at this point but click OK to continue!");
                var userAnswer4 = prompt(question4);
                if (userAnswer4.toUpperCase() === answer4.toUpperCase()){
                    correct += 1;
                    alert("About time... go ahead if you want. Click OK.");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("yaaaay... two... you got two. *golfclap* ")
                        alert("Here's your lousy crown.");
                        alert("Enjoy your mediocrity, Mr. Bronze.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("One? Really?")
                        alert("You're just awful... how did you not know these things?");
                        alert("Know what? Don't care. I can feel the internet getting dumber as long as your here. Scram.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }

                    }
                } else {
                    alert("SERIOUSLY??");
                    var userAnswer5 = prompt(question5);
                    if (userAnswer5.toUpperCase() === answer5.toUpperCase() || userAnswer5.toUpperCase() === answer5a.toUpperCase()){
                        correct += 1;
                        alert("WOW... you managed to squeeze one out. Congratulations on having the same success as a monkey with a dartboard.")
                        alert("Here's your lousy bronze crown.");
                        alert("I hope it tarnishes, you disappointment.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else {
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    }
                    } else {
                        alert("...")
                        alert("0... 0 points on a simple 5 question quiz.");
                        alert("Be gone with you and don't breed, you mouthbreather.");
                        if (correct === 5){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a meaningless Gold Crown!</h1>");
                    } else if (correct >= 3){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive a mediocre Silver  Crown!</h1>");
                    } else if (correct > 0){
                        document.write("<h1>Congrats. You got " + correct + " answers correct. You receive an extremely unremarkable Bronze Crown!</h1>");
                    } else { 
                        document.write("Abysmal... fucking abysmal. Not even a pewter crown for you. I can't even begin t... CHEVY MAKES CORVETTE FOR CRYIN OUT LOUD...");

                    }}

                }

            }
        }   
    }

}else {
    alert("Sorry to hear that. Have a good day, dummy.");
}```