Catherine Gracey

Living Life, One Misadventure At A Time.

Coding Adventures: The Mood Checker

on January 4, 2015

I started to teach myself JavaScript on 20 October 2014. After much careful research and self study, I present to you the following to determine how well your coding session is going. Feel free to use it as you see fit.

function moodChecker(hoursSpentCoding, numberOfBugs, numberOfBugsSolved){
    if (numberOfBugs <= numberOfBugsSolved && hoursSpentCoding <= 8){
        alert("Quit while you're ahead!");
        return "150%";
    } else if (numberOfBugs <= numberOfBugsSolved && hoursSpentCoding > 8) {
        alert("Shouldn't you be curing cancer?");
        return "150%";
    } else if (numberOfBugs > (numberOfBugsSolved * 10)){
        alert("Just give up and log into Stack Overflow. You know you want to.");
        return "0%";
    } else if (numberOfBugs > (numberOfBugsSolved * 5)){
        alert("You deserve a lot of cookies. Soak them in rum.");
        return "5%";
    } else if (numberOfBugs > (numberOfBugsSolved * 2)){
        alert("You deserve a lot of cookies.");
        return "25%";
    } else {
        console.log("Sounds legit.");
        return "100%";

Agree? Disagree? Concerned that I’m now blogging code snippets?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: