JavaScript Basics u0026 Fundamentals Challenge Quiz

Test your knowledge of JavaScript essentials including syntax, variables, data types, operators, and type conversion. This quiz is designed to assess your understanding of core JavaScript concepts and their correct applications.

  1. Variable Declaration Nuance

    Which statement correctly declares a block-scoped variable that cannot be reassigned in JavaScript?

    1. const fruit = 'apple';
    2. block fruit = 'apple';
    3. var fruit = 'apple';
    4. let fruit = 'apple';
    5. static fruit = 'apple';
  2. Comment Syntax Challenge

    Which of the following is the correct way to write a multi-line comment in JavaScript?

    1. ' This is a comment
    2. # This is a comment #
    3. // This is a comment //
    4. u003C!-- This is a comment --u003E
    5. /* This is a comment */
  3. Type Conversion Intricacies

    Given let str = '123'; which code snippet properly converts str to a number?

    1. String(str);
    2. Number(str);
    3. str.toFloat();
    4. cast(str, Number);
    5. parseChar(str);
  4. Hoisting and Scope

    What will be logged by the following code: console.log(x); var x = 5;

    1. TypeError
    2. null
    3. undefined
    4. ReferenceError
    5. '5'
  5. Strict Equality Operator

    Which operator checks both value and type equality in JavaScript?

    1. ==
    2. !=
    3. =
    4. !===
    5. ===
  6. Bitwise Operator Usage

    What is the result of the expression: 5 u0026 3?

    1. 7
    2. 8
    3. 1
    4. 2
    5. 0
  7. Logical Operator Precedence

    What does the expression true || false u0026u0026 false evaluate to?

    1. undefined
    2. false
    3. NaN
    4. null
    5. true
  8. Immutable Binding

    Which statement about variables declared with const is correct?

    1. The value assigned to a const variable can be reassigned later.
    2. const variable must be initialized at the time of declaration.
    3. const makes deep objects primitive.
    4. const always creates a global variable.
    5. A const declaration can be left uninitialized.
  9. Typeof Operator Deep Dive

    What is the result of typeof null in JavaScript?

    1. 'null'
    2. 'object'
    3. 'Void'
    4. 'NaN'
    5. 'undefined'
  10. String to Boolean Conversion

    Given let str = 'false'; what does Boolean(str) evaluate to?

    1. true
    2. NaN
    3. undefined
    4. false
    5. null
  11. Variable Scope Complexity

    Which keyword ensures a variable only exists within its containing block or statement?

    1. static
    2. let
    3. define
    4. var
    5. global
  12. Floating Point Peculiarities

    What will be logged by console.log(0.1 + 0.2 === 0.3)?

    1. TypeError
    2. undefined
    3. true
    4. false
    5. NaN
  13. Unary Plus Operator

    Which expression converts the string '8' to the number 8?

    1. -'8'
    2. parseChar('8')
    3. 8/'8'
    4. '8'+0
    5. +'8'
  14. Logical NOT Operator

    What is the result of !!undefined in JavaScript?

    1. false
    2. true
    3. NaN
    4. undefined
    5. null
  15. Operator Associativity Detail

    What does 3 + 4 * 2 evaluate to in JavaScript?

    1. 11
    2. 8
    3. 16
    4. 14
    5. 10