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 TypeScript String repeat() Method pankajbind Follow Improve Article Tags : JavaScript Web Technologies TypeScript Similar Reads 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 Lodash _.repeat() Method Lodash _.repeat() method is used to repeat the given string n times. Syntax:_.repeat(string, n);Parameters: string: This parameter holds the string to repeat.n: n is the number of times to repeat the string.Return Value: This method returns the repeated string. Example 1: In this example, we are rep 1 min read How to repeat a string to a specific number of times in PHP ? A string is a sequence of characters stored in PHP. The string may contain special characters or numerical values or characters. The strings may contain any number of characters and may be formed by the combination of smaller substrings. Table of ContentUsing for loopUsing str_repeat methodUsing Rec 3 min read JavaScript Program to Find Kâth Non-Repeating Character in String The K'th non-repeating character in a string is found by iterating through the string length and counting how many times each character has appeared. When any character is found that appears only once and it is the K'th unique character encountered, it is returned as the result. This operation helps 6 min read JavaScript Program to Get a Non-Repeating Character From the Given String In JavaScript, we can find the non-repeating character from the input string by identifying the characters that occur only once in the string. There are several approaches in JavaScript to get a non-repeating character from the given string which are as follows: Table of Content Using indexOf and la 3 min read Like