Top JavaScript Interview Quiz: Key Concepts & Output-Based Questions

Test your JavaScript knowledge with this quick quiz! Covers essential concepts like array methods (map, filter, reduce), object destructuring, arrow functions and this, and error handling using try-catch. Perfect for developers preparing for JavaScript interviews or improving core programming skills!

Question 1.

What will the following code output?

  • A.

    [2, 4, 6, 8]

  • B.

    [6, 8]

  • C.

    [4, 6, 8]

  • D.

    [12]

Question 2.

How do you access name from this object?

  • A.

    person["name"]

  • B.

    person.name

  • C.

    Both A and B

  • D.

    person[name]

Question 3.

What will this arrow function return?

  • A.

    10

  • B.

    15

  • C.

    NaN

  • D.

    undefined

Question 4.

What is the value of this in the following code?

  • A.

    obj

  • B.

    undefined

  • C.

    Global object (window in browsers)

  • D.

    null

Question 5.

Identify the error in this code:

  • A.

    x is not defined.

  • B.

    The code will throw an uncaught error.

  • C.

    Syntax error.

  • D.

    No error; it will log "Error caught".

Question 6.

What will this code log?

  • A.

    6

  • B.

    0

  • C.

    [1, 2, 3]

  • D.

    NaN

Question 7.

What does this destructuring assignment do?

  • A.

    Throws an error

  • B.

    Alice 25

  • C.

    undefined undefined

  • D.

    null null

Question 8.

What will the output be?

  • A.

    [20, 40, 60]

  • B.

    undefined

  • C.

    [10, 20, 30]

  • D.

    An error

Question 9.

What happens if this try-catch block is executed?

  • A.

    Logs "Something went wrong"

  • B.

    Throws an uncaught error

  • C.

    Logs "undefined"

  • D.

    Does nothing

Question 10.

What does this code log?

  • A.

    Hello, !

  • B.

    Hello, Guest!

  • C.

    Hello, undefined!

  • D.

    An error