Course: JavaScript

Progress (0%)

  1. Foundation

  2. Numbers

  3. Strings

  4. Conditions

  5. Loops

  6. Arrays

  7. Functions

  8. Objects

  9. Exceptions

  10. HTML DOM

  11. CSSOM

  12. Events

  13. Drag and Drop

  14. opt Touch Events

  15. Misc

  16. Project: Analog Clock

Conditions Quiz

Quiz 9 4 questions

Prerequisites for the quiz

  1. Whole JavaScript Conditions unit

Are you ready?

4 questions to solve

Instructions
  1. This quiz goes to full-screen once you press the Start button.
  2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
Boolean(false) gets converted to...
false is simply the boolean false and hence will get converted to false. For more info refer to JavaScript Booleans.
Boolean("false") gets converted to...
Only empty strings with length 0 get converted to the boolean false. Likewise in this case the answer would be true.
We can have an else if statement without an if.
True or false?
if statement needs to precede else if and else statements. More at JavaScript if...else if...and else.
What does the following code log in the console?
var fruit = "orange";

switch (fruit) {
    case "orange":
        console.log("Citrus");
    case "mango":
        console.log("Sweet");
        break;
}
The value inside switch is matched against each case and if an identical match is found the corresponding code is executed.