Learn Create Your Own Split Screen

Next Page

Here's another example of the same pattern:
if (day == "Monday") { alert("I don't like Mondays"); } else if (day == "Saturday" || day == "Sunday"){ alert("Hooray, the weekend"); } else if (day == "Wednesday") { alert("Some people call this 'hump day'"); } else if (day == "Friday") { alert("Weekend tomorrow!"); } else if (day == "Tuesday" || day = "Thursday") { alert("Just another day..."); } else { alert("Invalid day. Please reboot the universe."); }
It's simple enough code, just a bit long-winded.

The verbosity of it tends to obscure the big picture "pattern" that there's a thing called "day", and we're going to do a bunch of different things just depending on what it's equal to, and not depending on anything else.