JavaScript MCQs with answers Page - 151

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 of these is a valid JavaScript variable name?

  • (A) 1value
  • (B) $value
  • (C) var
  • (D) -value

A

Admin • 833K Points
Coach

Q. Which keyword is used for inheritance in ES6 classes?

  • (A) extends
  • (B) implements
  • (C) inherits
  • (D) derive

A

Admin • 833K Points
Coach

Q. What will this output?

Code:
console.log(typeof function(){});
  • (A) object
  • (B) function
  • (C) undefined
  • (D) string

A

Admin • 833K Points
Coach

Q. How can you prevent a variable from being reassigned?

  • (A) Use var
  • (B) Use let
  • (C) Use const
  • (D) Use strict

A

Admin • 833K Points
Coach

Q. What will the following code return?

Code:
let x = 0;
if (x) { console.log('true'); } else { console.log('false'); }
  • (A) true
  • (B) false
  • (C) undefined
  • (D) 0

A

Admin • 833K Points
Coach

Q. Which method checks if an array contains a certain value?

  • (A) has()
  • (B) contains()
  • (C) includes()
  • (D) exists()

A

Admin • 833K Points
Coach

Q. What will be the result?

Code:
const obj = {name: 'John'};
delete obj.name;
console.log(obj.name);
  • (A) undefined
  • (B) John
  • (C) null
  • (D) Error

A

Admin • 833K Points
Coach

Q. What is the default return value of a function with no return statement?

  • (A) null
  • (B) 0
  • (C) undefined
  • (D) false

A

Admin • 833K Points
Coach

Q. What will be logged?

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

A

Admin • 833K Points
Coach

Q. Which statement is used to exit a loop early?

  • (A) exit
  • (B) continue
  • (C) stop
  • (D) break

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