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 - How to Pad a String to Get the Determined Length? Here are different ways to pad a stirng to get the specified length in JavaScript.1. Using padStart() MethodThe padStart() method can be used to pad a string with the specified characters to the specified length. It takes two parameters, the target length, and the string to be replaced with. If a nu 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 JavaScript Program to Check for Repeated Characters in a String Here are the different methods to check for repeated characters in a string using JavaScript1. Using a Frequency Counter (Object)A frequency counter is one of the most efficient ways to check for repeated characters in a string. This approach involves iterating over the string and counting how often 3 min read JavaScript Program for Generating a String of Specific Length In this article, we are going to discuss how can we generate a string having a specific length. You might encounter many situations when working with JavaScript where you need to produce a string with a specified length. This could be done for a number of reasons, including generating passwords, uni 4 min read 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 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 Like