JavaScript MCQs with answers Page - 146

Here, you will find a collection of MCQ questions on JavaScript. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 833K Points
Coach

Q. Which function is used to execute a function after a delay?

  • (A) setInterval()
  • (B) setTimeout()
  • (C) delay()
  • (D) timeout()

A

Admin • 833K Points
Coach

Q. Which one will return 'true'?

Code:
console.log([] == ![]);
  • (A) true
  • (B) false
  • (C) undefined
  • (D) NaN

A

Admin • 833K Points
Coach

Q. Which of the following creates a new array with results of calling a function on every element?

  • (A) map()
  • (B) filter()
  • (C) forEach()
  • (D) every()

A

Admin • 833K Points
Coach

Q. What will be logged?

Code:
console.log('2' - '1');
  • (A) 1
  • (B) 11
  • (C) NaN
  • (D) Error

A

Admin • 833K Points
Coach

Q. How can you prevent a default event action in JavaScript?

  • (A) event.block()
  • (B) event.preventDefault()
  • (C) event.stop()
  • (D) event.cancel()

A

Admin • 833K Points
Coach

Q. What is the output?

Code:
console.log(typeof []);
  • (A) object
  • (B) array
  • (C) list
  • (D) undefined

A

Admin • 833K Points
Coach

Q. What will this return?

Code:
[1, 2, 3].reduce((a, b) => a + b);
  • (A) 6
  • (B) 1
  • (C) [1, 2, 3]
  • (D) Error

A

Admin • 833K Points
Coach

Q. What does the following return?

Code:
console.log(typeof null);
  • (A) null
  • (B) object
  • (C) undefined
  • (D) NaN

A

Admin • 833K Points
Coach

Q. Which of these is not a looping structure in JavaScript?

  • (A) for
  • (B) foreach
  • (C) while
  • (D) do...while

A

Admin • 833K Points
Coach

Q. What will the code output?

Code:
console.log([] + []);
  • (A) []
  • (B) undefined
  • (C) NaN
  • (D) ""

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ