JavaScript MCQ Javascript String MCQ Question #4901
Single Choice Easy

QWhat is the result of the following code?
var str = "Hello World!";
console.log(str.endsWith("World!"));

ID: #4901 Javascript String MCQ 199 views
Question Info
#4901Q ID
EasyDifficulty
Javascript String MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A true
  • B false
  • C "false"
  • D "true"
Correct Answer

Explanation

The endsWith method in JavaScript is a method that can be called on a string value to determine whether the string ends with the specified string.
In this case, the endsWith method is called on the string "Hello World!", with the string "World!" as the argument.
Since the string "Hello World!" does end with the string "World!", the endsWith method will return true.

No Previous Next Question

Share This Question

Challenge a friend or share with your study group.