Goal: In the More Branching lesson, we learned about:
&&
and the logical "or" ||
operators!
operatorPractice using these operators, and begin familiarizing yourself with the concepts of truthy and falsey by completing the exercises listed below.
blue
, red
, and purple
are variables. if (blue === true && red === false || purple === true)
Meet the goal by completing one of the practice prompts below.
Both sites should check for any form fields the user has left blank. If you're checking multiple fields, don't pop up a dialog box for each one; that could get annoying if the user has left multiple fields blank! Instead, insert text next to the field the user has missed. Bootstrap has some nice styles for this — check out the Validation section of their form documentation.
Create a celebrity dating webpage, where you enter information about yourself, and the page suggests which celebrity, fictional character, or public figure you would be most compatible with.
How you decide to calculate the compatibility can be arbitrary. Just make sure to try out using the ||
and &&
operators.
Make a political belief meter/quiz that asks questions about users' values, and determines how liberal, moderate, or conservative they are.
How you decide to calculate how liberal, moderate, or conservative a user is can be arbitrary. Just make sure to try out using the ||
and &&
operators.