TypeScript String repeat() Method Last Updated : 28 Apr, 2025 Comments Improve Suggest changes 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 How to Repeat a String in JavaScript ? 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 PHP str_repeat() Function The str_repeat() function is a built-in function in PHP and is used to create a new string by repeating a given string fixed number of times. It takes a string and an integer as arguments and returns a new string which is generated by repeating the string passed as an argument by the number of times 2 min read How to Repeat a String in JavaScript ? The javascript string is an object that represents a sequence of characters. We are going to learn how can we repeat a string using JavaScript. Below are the methods to repeat a string in JavaScript:Table of ContentUsing the repeat() methodUsing for LoopUsing the Array constructor and join() methodU 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 Like