
JavaScript String repeat() Method - W3Schools
The repeat() method returns a string with a number of copies of a string. The repeat() method returns a new string. The repeat() method does not change the original string.
String.prototype.repeat() - JavaScript | MDN - MDN Web Docs
Mar 13, 2025 · The repeat() method of String values constructs and returns a new string which contains the specified number of copies of this string, concatenated together.
Repeat a string in JavaScript a number of times - Stack Overflow
Jul 5, 2024 · /** * Repeat a string `n`-times (recursive) * @param {String} s - The string you want to repeat. * @param {Number} n - The times to repeat the string. * @param {String} d - A …
Three ways to repeat a string in JavaScript - freeCodeCamp.org
Feb 13, 2017 · In this article, I’ll explain how to solve freeCodeCamp’s “Repeat a string repeat a string” challenge. This involves repeating a string a certain number of times. There are the …
Repeat String - Javascript - Stack Overflow
What is the best or most concise method for returning a string repeated an arbitrary amount of times? The following is my best shot so far: var a = []; while(a.length < n){ a.push(s); return …
How to Repeat a String in JavaScript - GeeksforGeeks
Jun 27, 2024 · This method is used to create a new string by repeating an existing string a specified number of times using the repeat() method. If a user provides the count to be 0 or …
How can I repeat strings in JavaScript? - Stack Overflow
Apr 3, 2013 · In JavaScript, how would I create a string of repeating strings x number of times: There is no such function, but hey, you can create it: return (new Array(times + 1)).join(this); …
JavaScript String repeat() Method - GeeksforGeeks
Jun 26, 2024 · The repeat() method in JavaScript returns a new string by concatenating the original string a specified number of times. This method accepts a single parameter. count: …
JavaScript String repeat() (With Examples) - Programiz
The repeat() method creates a new string by repeating the given string a specified number of times and returns it. Example const holiday = "Happy holiday!";
JavaScript String repeat () Method
The String.prototype.repeat() method returns a new string that repeats the original string a number of times. Here’s the syntax of the repeat() method: str .repeat ( count ) Code …
- Some results have been removed