JavaScript MCQs with answers Page - 150

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. How to convert a string to an integer in JavaScript?

  • (A) parseInt(str)
  • (B) Number(str)
  • (C) +str
  • (D) All of the above

A

Admin • 833K Points
Coach

Q. Which statement is true for arrow functions?

  • (A) They bind their own 'this'
  • (B) They use lexical 'this'
  • (C) They are block-scoped
  • (D) They must use function keyword

A

Admin • 833K Points
Coach

Q. What will be logged?

Code:
let arr = [1, 2, 3];
arr.length = 1;
console.log(arr);
  • (A) [1]
  • (B) [1, 2, 3]
  • (C) []
  • (D) [1, 2]

A

Admin • 833K Points
Coach

Q. What is the result of the following?

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

A

Admin • 833K Points
Coach

Q. What will this expression return?

Code:
Boolean([]);
  • (A) true
  • (B) false
  • (C) undefined
  • (D) null

A

Admin • 833K Points
Coach

Q. Which is not a valid JavaScript data type?

  • (A) Undefined
  • (B) Boolean
  • (C) Float
  • (D) Symbol

A

Admin • 833K Points
Coach

Q. What is the output?

Code:
console.log('2' + 2 - 2);
  • (A) 22
  • (B) 2
  • (C) NaN
  • (D) 0

A

Admin • 833K Points
Coach

Q. What does the following return?

Code:
[] == ![];
  • (A) true
  • (B) false
  • (C) undefined
  • (D) TypeError

A

Admin • 833K Points
Coach

Q. Which method is used to convert an object to JSON string?

  • (A) JSON.parse()
  • (B) JSON.stringify()
  • (C) toString()
  • (D) parseJSON()

A

Admin • 833K Points
Coach

Q. Which array method returns a new array with only truthy values?

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

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