JavaScript MCQs with answers Page - 148

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 keyword creates a constant in JavaScript?

  • (A) let
  • (B) constant
  • (C) const
  • (D) define

A

Admin • 833K Points
Coach

Q. What will be the value of x?

Code:
let x = '2' * '3';
  • (A) '6'
  • (B) 6
  • (C) NaN
  • (D) 23

A

Admin • 833K Points
Coach

Q. What does 'this' refer to in a regular function?

  • (A) Global object
  • (B) Window object in browser
  • (C) Object that called the function
  • (D) All of the above

A

Admin • 833K Points
Coach

Q. What will the following return?

Code:
typeof Infinity;
  • (A) number
  • (B) infinity
  • (C) undefined
  • (D) object

A

Admin • 833K Points
Coach

Q. Which of the following is used to create a new Promise?

Code:
let p = new Promise((resolve, reject) => {});
  • (A) Correct syntax
  • (B) Incorrect syntax
  • (C) Deprecated
  • (D) Throws error

A

Admin • 833K Points
Coach

Q. What will be logged?

Code:
console.log(typeof undefined === typeof null);
  • (A) true
  • (B) false
  • (C) undefined
  • (D) Error

A

Admin • 833K Points
Coach

Q. What does '===' operator check?

  • (A) Only value
  • (B) Only type
  • (C) Value and type
  • (D) None of the above

A

Admin • 833K Points
Coach

Q. What is the default value of 'this' in a JavaScript class method?

  • (A) window
  • (B) undefined
  • (C) the class instance
  • (D) null

A

Admin • 833K Points
Coach

Q. What will be the output?

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

A

Admin • 833K Points
Coach

Q. Which of the following is a correct way to declare an arrow function?

  • (A) function => {}
  • (B) () -> {}
  • (C) () => {}
  • (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