Module quiz: Introduction to JavaScript

Module quiz: Introduction to JavaScript

  1. You can run JavaScript in a web browser's devtools console.

    • true

    • false

  2. Which of the following are valid comments in JavaScript? Select all that apply.

    •     \ Comment 1
      
    •     // Comment 2
      
    •     ##
          ## Comment 3
          ##
      
    •     /*
          * Comment 4
          */
      

  3. Which of the following are valid data types in JavaScript? Select all that apply.

    • string

    • numbers

    • booleans

    • null

  4. Which of the following is the logical AND operator in JavaScript?

    •     &
      
    •     &&
      
    •     ||
      
    •     |\
      

  5. Which of the following is the assignment operator in JavaScript?

    •     =
      
    •     ==
      
    •     ===
      

  6. How many times will the following code print the word 'Hello'?

     for(var i = 0; i <= 5; i++) {
       console.log("Hello");
     }
    
    • 4

    • 5

    • 6

  7. What will print out when the following code runs?

     var i = 3;
     var j = 5;
    
     if(i == 3 && j < 5) {
       console.log("Hello");
     } else {
       console.log("Goodbye");
     }
    
    • Hello

    • Goodbye

    • Nothing

  8. What will print out when the following code runs?

     var i = 7;
     var j = 2;
    
     if(i < 7 || j < 5) {
       console.log("Hello");
     } else {
       console.log("Goodbye");
     }
    
    • Hello

    • Goodbye

    • Nothing

  9. The result of !false is:

    • true

    • undefined

  10. What does the operator symbol || represent in JavaScript?

    • The logical OR operator

    • The logical NOT operator

    • The logical AND operator