TypeScript String repeat() Method Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report In TypeScript the repeat() method helps in generating a new string by replicating the original string up to a certain number of iterations. It's an inbuilt method of TypeScript as well as JavaScript. Syntaxstring.repeat(count: number): string;Parameters:count: No. of times you want to repeat the string. Return Value:A new string consisting of the original string repeated count times. Example 1: To demonstrate creating a string by repetition of a string using repeat() method. JavaScript const geek: String = "GeeksForGeeks"; const repeatedGeek: String = geek.repeat(3); console.log(repeatedGeek); Output: GeeksForGeeksGeeksForGeeksGeeksForGeeksExample 2: To demonsrating creating a String by repetition of a string. JavaScript const numString: String = "12345"; const repeatedNumString: String = numString.repeat(2); console.log(repeatedNumString); Output: 1234512345 Comment More infoAdvertise with us Next Article JavaScript String repeat() Method P pankajbind Follow Improve Article Tags : TypeScript Similar Reads String Class repeat() Method in Java with Examples The string can be repeated N number of times, and we can generate a new string that has repetitions. repeat() method is used to return String whose value is the concatenation of given String repeated count times. If the string is empty or the count is zero then the empty string is returned. Syntax: 1 min read JavaScript String repeat() Method The repeat() method in JavaScript returns a new string by concatenating the original string a specified number of times. Syntax:string.repeat(count);Parameters:This method accepts a single parameter. count: count is an integer value that shows the number of times to repeat the given string. The rang 3 min read Get repetition of a string in Julia - repeat() Method The repeat() is an inbuilt function in julia which is used to return a string which is the repetition of specified string with specified number of times. Syntax: repeat(String::AbstractString, r::Integer) Parameters: String: Specified string or character r::Integer: Specified number of times Returns 2 min read Repeating a String for Specific Number of Times in Golang In Go language, strings are different from other languages like Java, C++, Python, etc. It is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding. You are allowed to repeat a string of for a specific number of times with the 3 min read C# | CharEnumerator.Clone() Method CharEnumerator.Clone Method is used to create a copy of the current CharEnumerator object. This is useful for saving the current state while iterating through a String object. Syntax: public object Clone (); Return Value: This method returns an Object which is a copy of the current CharEnumerator ob 2 min read Repeat Character String N Times in R In this article, we will discuss how to repeat the character string N times in the R programming language. Character string means a set of characters . Example: "Hello Geek","Python","Languages_Python" are some examples Method 1: Using replicate() method This function used to give n replicas from th 3 min read Like