Single Choice
Easy
QWhat is the result of the following code?
var str = "Hello World!";
console.log(str.repeat(3));
ID: #4903
Javascript String MCQ
220 views
Question Info
#4903Q ID
EasyDifficulty
Javascript String MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The repeat method in JavaScript is a method that can be called on a string value to create a new string that is the specified number of copies of the original string.
In this case, the repeat method is called on the string "Hello World!", with the number 3 as the argument.
The repeat method will create a new string that is 3 copies of the original string, resulting in the string "Hello World!Hello World!Hello World!".
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic