JavaScript Objective Questions and Answers

This JavaScript MCQ quiz contains carefully curated objective and code-based questions with correct answers and clear explanations. Ideal for beginners, experienced developers, and interview preparation, covering core JavaScript, ES6+, asynchronous programming, and DOM manipulation.

Practice JavaScript MCQs with Detailed Explanations

Answer at least 12 questions to submit.

1.
Easy
Which keyword is used to declare a block-scoped variable in JavaScript?
2.
Easy
What is the output of the following code?

let x = 5;
{
  let x = 10;
}
console.log(x);
3.
Easy
Which of the following is NOT a JavaScript primitive type?
4.
Easy
What is the output of:

console.log(typeof null);
5.
Easy
Which operator compares both value and type?
6.
Medium
What is hoisting in JavaScript?
7.
Medium
What will be the output?

console.log(a);
var a = 10;
8.
Easy
Which function delays execution?
9.
Medium
What is the output?

for (var i = 0; i < 3; i++) {}
console.log(i);
10.
Easy
What does Array.prototype.map() return?
11.
Easy
What is the output?

const arr = [1, 2, 3];
const result = arr.map(x => x * 2);
console.log(result);
12.
Medium
What does an async function always return?
13.
Medium
What is the output?

async function test() {
  return 5;
}
console.log(test());
14.
Easy
Which method handles promise rejection?
15.
Medium
What is closure in JavaScript?
Answered: 0 / 15