Exercise Thursday

Goal: In the More branching lesson, we learned:

  • The && and the || operator
  • The JavaScript values of truthy and falsey

Practice using these operators, and begin familiarizing yourself with the concepts of truthy and falsey by completing the exercises listed below.

Warm Up


  • What is an example of something JavaScript considers to be falsey? Why is it falsey?
  • What condition does the following line of code check for? if (blue === true && red === false || purple === true)

Code


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.

Celebrity Dating Quiz

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.

Political Meter

Make a political belief meter/quiz that asks questions about users' values, and determines how liberal, moderate, or conservative they are.

Lesson 58 of 65
Last updated May 23, 2022