string repeat

Solutions on MaxInterview for string repeat by the best coders in the world

showing results for - "string repeat"
Juan Diego
03 Oct 2016
1var a="a";
2var aaa=a.repeat(3); // "aaa"
3
Jonas
04 Apr 2018
1function repeatStringNumTimes(string, times) {
2  var repeatedString = "";
3  while (times > 0) {
4    repeatedString += string;
5    times--;
6  }
7  return repeatedString;
8}
9repeatStringNumTimes("abc", 3);
Fernando
08 Feb 2017
1repeatStr = (n, s) => s.repeat(n);
Antony
20 Jan 2016
1
2var str = "Hello world!";
3
4 str.repeat(2);
5 
Marion
11 Jul 2020
1// hey buddy, here are different implementations, choose your favourite !!
2
3
4// best implementation
5repeatStr = (n, s) => s.repeat(n);
6
7
8// short
9function repeatStr(n, s) {
10  return s.repeat(n);
11}
12
13
14// without using repeat
15function repeatStr(n, s) {
16  var str = "";
17  for (var i = 0; i < n; i++) str += s;
18  return str;
19}
queries leading to this page
concatenate string number of times javascriptrepeat numbers from 1 to 10 in js as stringadd string number of time javascripthow to repeat a string jsrepeat jhow to make a js code repeatmultiply string in javascriptstring repeat 28 29 in jshow to repeat string i for loop in javascripttorepeat javascrtipthow to make js code repeatjavascript why does my console log repeat multiple timesmdn string repeatjavascript strings how to add a character i timesmultiple string javascriptjs find repeated stringrepeate stringstring repeat javascriptduplicate string jsjavascript generate string of characters repeat 28 29string fill js repeat jsjs repeat string for loopjs repeat methodjavascript multiplying stringshow to make a string repeat jsrepetition of word javascriptjs repeat character n timesstring repeat 28 29using string repeat jsrepeat a string in javascriptm repetiion javascriptjs fill string javscript repeat e2 80 9cjavascript string repeat documentation e2 80 9dhow to return a string x amount in javascriptjs repeaterecurring javascriptjavascript how many times does a digit repeatjavascript repear a stringjs repeat string infinatelyhow to make something repeat in javascriptduplicate string javascriptstring fill jsstring multiplication in javascriptcreate a string of repeating characters javascriptstring multiplication javascriptwhat is repeat in js repeat 28 29 mdn repeat javascriptrepeats the string a random amount of timeshow eleminate the character repeat in javascripthow do you multiply a string javascriptjs iter repeatmultiply a char javascriptwhat is the repeat cmd for jshow to repeat a function in jsrepeat charachter for very long timeshow to replicate character in javascriptjs make a strig with repeated charsstring repeat in jsjavascript multily letterreturn one string that is the given string repeated n times javascriptsobject repeatjs multply stringstring repeat 28 29 mdnjs 2c repeat stringjavascript repeat imerjs create a string of n spacesmultiply string javascritp repeat in javascriptjs repeat x timesrepeat string twice javascriptstrint repeatrepeat string n times javascriptstring repeatrepeat functioncreate repeating letters jsrepeat mdnmultiply char and number javascriptrepeat function examplesrepeat n 28xx 29 5b30 5d in javascriptjs repeat 28 29repeat in jswrite a function called repeatstring which repeats the given string src exactly count times in jssyntax javascript repeatjs repeat charsmultiply a string in javascriptrepeat javascript functionjavascript string char repeat function to repeat a string js char repeatjs repeat 28 29string prototype repeat discord jshow to repeat each character in a string in javascriptstring repeatmultiply the same string javascriptstr repeat 28this 29typescript print value x timesrepaet jsstring repeat javascriptcopy string num times jsjs repeatrepeat javascriptstring method that repeats char n times jsrepeat code javascripthow to multiply a string in javascripthow to repeat the character in string in javascriptnodejs repeat string contentstring repeatmultiplying strings jsjavasxript repearrepeating a string with a for looprepeat string javascript for loophow to remove characters from a string n times javascripthow to repeat a diger dew times jsrepeat 28 29 javascriptwhat does string times string do in jsduplicate a string javascriptjavascript what is repeatjs repeat character based on positionrepeat js stringrepeated string javascriptrepeating letters javascriptjs multiplying a stringrepeated characters in string by position javascriptrepeat 28 29 in javascriptjs run string multiple timeshow to repeat loop in table format replace keyword in jqueryjavascript method for multiplying string charactersrepeat js number of timesrecurring methods jsrepeat jsjavascript print character n timesjava script repeatrepeat 28 29javascript string repeat documentationrepeate the string repeat the string in javascriptjavascript repeat stringhow to repeate same function in javascriptstring repeat methodmultiply string in jsjavascript repeat character n times in stringrepeats node jshow to repeat code javascript repeat 280 29 24 22 repeatjs repeated stringrepeater jsnmultiply strings javastriptjs string multiplyjs return string 3 timeshow to repeat a function without the repeatstring repeajs string duplicatejs repeat how to repeat a string in javascriptrepeat stringrepeat js 5chow to multiply strings in jsstring repeat 28 29 maxprint a symbol x amount of times in javascriptwrite a function called repeat str which repeats the given string src exactly count times javascript how to repeat indexrepeat method javascripthow to repeat stringjs multiply lettersjs string repetestring repeat 28repeat space jsjavascript string repeat documentation e2 80 9dwhat to use instead of repeat 28 29 jsrepeat a stringhow to repeat a console by length in jsjavascript string repeat n timesprint a varable n times javascroptrepeat string loop adding one with jsstring repeat javascriptrepeat java scriptjavascript string multiplyhow to repeat a stringjs equivalent str repeatrepeat a string repeat a string javascriptfor loop repeat stringrepeat string char in javacriptjavascript multiply string by integerprint string n times javascripthow to repeat a string i jshow do you solve a function that repeats the same wordmutliply string javascriptrepeat number according to position javascriptrepeat character n times javascriptconsole log x times based on number jsrepeat a string x times javascriptjavascript string repeat alternativewrite a js program that repeats a given string n number of times write a js function that takes two arguments 3a a string and a positive number n this function repeats the given string n number of times and returns the result nodejs string repeatmaking a string filled with strings javascriptjavascript repeat character x number of timesrepeat command javascriptnode js multiply stringsstrings repeatrepeat character in jsrepeat text javascriptstring cannot repeat javascriptstring repeat function in javascriptrepeat character jsjavascript function repeatrepeate jsrepeat a certain character nodejsrepeat a string n time nodehow to multiply characters in javascriptprint n character of same number jsrepeat in javascript repeat in jsstring repeat with delimiter javascriptstr repeatrepat jsrepeat loop jsjavascript code in script repeatrepeat command jsrepeat string javascriptwrite a function in js that repeat stringhow to make a function repeat in javascriptrepeat loopstring repeat 28 29 jswhat does repeat does in javscriptjavascript add multiple characters to stringmultiply a string a number of times javascriptjavascript string of repeated charactershow to repeat code in javascript for spammingrepeat function javascripthow to print string 3 times in jshow to repeat mutipile strings in jsprint a string n times javascriptjavascript multiply charactersrepeater js how to manually repeat in jshow to know repeat character jshow to write a function instead of repeat in javascriptjs print string n timesrepeat a function in javascriptjs how to repeat a string in a different field repeat jashjavascipt repeat a stringjs char multiply repeat 28 29 jsjavascript generate long stringduplicate string x times javascriptjs how to to multiply a string set number of times within a single stringhow to repeat a string in python javascriptfunction repeatstringnumtimes 28str 2c num 29 7b return str repeat 28y 29 3b meaningjavascript multiple stringjavascript template string duplicateduplicating a string in javascriptjavascript repeat something in amount of timehow to repeat a function java scriptrepeat a string n characters long javascriptrepeat a fucntion javascriptstring repeatjavascript join string x times repeat until n length javascriptstring repeat 28 29 mndreapeat a string till it is n length javascriptrepeat a character jshow to use repeat method in javascriptrepeat method javascriptjavascript repeat string infinite timesrepeat letter javascriptjavascript repeat 0javascipt repeathow to repeat something in javascripthow to return a string x amount in javascript without using repeatmultiplication string in jsmultiply strings jshow to make a string repeat in javascriptrepeat method in jsprint out a string multiple times javascript for loopsrepeater js exampleadd char to string n times jsmdn reapeatjavascript multiply stringsjavascript repeat scriptjavascript how to make a saying repeat 20 timeshow to times a number by a string js how to repeat only one letter in string javascriptstring repeat methodrepeat a string repeat a stringusing reduce to repeat a string in jsstring repeaterrepeating stringjavascript get multiple string repeated of indexcan you multiply strin javascriptjavascript repeate charrepeat a string a specified times javascriptjs print multiple of a stringjs concatenate strings number of timesmake function repeat in javascriptrepeat string infinite javascriptjs string repeat in another stringrepeat 28 functionhow to repeat a function in javascriptjavascript repeathow to repeat same string in javascriptrepeat method javascript examp c3 bclerepeat string jsrepeat a function repeat methodrepeat characters in a string javascriptjavascript repeat charjavascript repeat for ijs repeat functionstr repeat in javascriptrepeat something in javascript repeat 287 29 in jsnodejs repear textjs compare to same string repeatedlyrepeat jsstring from repeated character jsstring repeat jshow to repeat code in jsrepeat character in string in javascriptcan avalues repeat ina set jsrepeat function jsmultiply a string like python in jsrepeat string by multiply javascriptjs object repeatrepeat function in javascripthow to multiply strings in javascriptjs multiply stringsstr repeat jsmultiply a string javascriptrepeat a string javascriptreapeate stroingjavascript repeat functionjavascript repeater functionrepeat elements javascriptalternative methods to repeat 28 29 javascriptmultiply space in javascriptcheck repeat time in string jshow to repeate a letter with for loop jsreturn string 5 times in javascriptjavascript repeat wordmultiply character javascriptrpeat in javascripttypescript append string times 2stringrepeatrepeat addition of str jsrepeat character in javascriptmultiply a string by a number javascriptmdn string repeat 28 29string repeat onlinefunction repeat 28str 2c time 29js repeat charrepeat string javascript using for looprepeat a character x amount of times in a string jsrepeat character in string javascript repeat 28 29 method w3schools repeat in jslog a string x times jsstring repeat mdnrepeat string character javascriptrepeat a string in jshow to repeat an action in javascriptrepeat javascript multiple multiply a charachter javascriptjavascirpt insert charanter nuber of timeshow to repeat in javascriptjavascript string of repeated characters object number repeatrepeat a character n times javascripthow to repeat a character a number of times in javascriptmdn repeatrepeat string using repeat built in functionconcatenate string number of time javascriptstring repeat javascriptrepeat method on stringsjavascript repeat a charjavascript string 2a8 timesbasic algorithm scripting 3a repeat a string repeat a string passedjavascript repeajavascript can you multiply a stringrepeat string in javascriptwrite a function named repeater 28 29 that takes two arguments 28a string and a number 29 2c and returns a new string where the input string is repeated that many times javascript repeat same codehow to repeat string in javascript without repeat funsitonjs string repeatjavascript recursion string repeathow to repeat i times in javascriptjs repeat metotcode to get string repeatationconsole repeating in jquery repeat method javascriptjs string repeatjavascript string multiplierstring multiplication jjscreate repeating chracter jsmultiply strings in javascriptstring repearrepeat char javascriptjavascript concatenate string multiple ltimesrepeat element in string based on position javascriptjavascript reapeat stringtypescript repeatjavascript repeaterjavascript repeat a charachterrepeat string in jshow to repeat jshow to repeat letter in jsrepeat x times javascriptjavascript string repeat methodnode js repeat functionstring multiplicatoin jsfunction to repeat characterss by number in jshow to repeat code in javascriptwhat repeat 28 29 does in javascripthow to repeat character in string javascriptrepeat a char x times javascriptjavascript how to multiply a stringfunction repeat javascriptjavascript duplicate stringjs string repeat charjs multiply stringjavascript repeat charachterjavascript repeats functionhow to find a repeating substring in a string javascriptjs how to represent 3 repeatingrepeat character the string in javascriptjavascript repeat charactershow to multiple each word on string jsrepeat function in jsstring repeat in javascriptjavascript multiply stringjavascript repeat character n timesjs create string of lengthhtml write a string multiple timesrepeat a string with a loop in javascripthow to repeat the character of string in jsreproduce a string n times jshow to make a word repeat in javascriptletter repeation javascriptisrepeated javascripthow to mutiply a character in javascript consoleprint string multiple times javascriptjavascript string repeatrepeat string typescriptgenerate same string twice juery jshow to write a function to repeat a stringmake a letter repeat in javascriptprototype object repeatjavascript repeat the same word overstring rpeatjavascript strings multiplycreate string of repeated characters javascriptconvert repeating index to number jsprevent same value from repeat javascript apps scriptjavascript repeat funtionstr repeat in javascriptjavascript repeating a stringadd a character n times in string jsjavascript multiply string by numberjs repeatwrite out a string multiple times javascripthow to print a string only one time javascriptjavascript string multiplicationrepeat a string repeat a string in javascriptmake code repeat javascripthow to use str repeat 282 29 in jsstring repeat ajvascripthow to reapeat loop in replace keyword in jqueryjavascript repeat 28 29repeat javascript methodjavascript repeat loopjs repeat character x timeshow to repeat characters in javascriptrepeat a string jsdouble string jshow to print something repeatedly in javascriptjs multiply string by numberrepeat character by positon javascpritstring repeat in es6how to repeat a string with function in javascriptrepeating string without repeat 28 29js repeat funcitonmdn string repeat 28 29 javascript string repeated charactersmultiplying string javascriptjavascript repeat characterreapeat in jsjavascript x times stringjs repeat space tumeshow many times a string repeats javascriptjs repeat string charobject method repeatrepeat javasacariptrepeat character x times javascriptjavascript repaethow to repeat a string without repeat method in javascriptmultiply strings javascriptreapeat string jsrepeat fn in jsjavascript loop to repeat stringhow to repeat strings javascript repeat 28 29 javascriptrepeat amount of times javascriptjs repeat a string n timesrepeat fonciton javascriptjs repeaterhow to repeat strings in javascripthow to repeat a tag on html javascriptrepeat to ednt of string jsstring method for repeatrepeat method javascript programizjavascript repeat string n timesrepeat action jsjavascript create string of x charactersmultiply string javascriptjavascript repeat method mdnrepeat methodstring repeat javascript documentation mdnhow to print one nuber multiple times in javascriptjs repeat string n timeshow to make a repeat in jsstring repeat javascript behind the scenesrepeat jssstring repeat until particular length javascriptrepeat a string javascript in a plain textrecursion repeat char jsjs repeat stringmultiple string length jsjavascript method to repeat an action a given number of timesmultiplying strings javascriptrepeating a string sepratly 5 times javascripthow to repeat string in javascriptmultiply string jsrepeat the string in javascriptrepeat for variable number of times javascriptjavascript string repeat characterrepeat character javascriptstring repeat jsrepeat stringrepeat a function javascriptjs fastest way to get repeated stringsjavascript string repeatjs repeated similar ifjavascript repeat spacerepeat javascrtiponline string repeattypescript repeat characterstring constructor javascript repeat characterrepeating text in javascriptwhere we can use repeat for in javascripthow to repeat a character in javascripthow to multiply str in jshow to repeat first argument for second argument times in jsrepeat a string n times javascriptrepeat code jsrepeat 28 29 jsrepeat word jsmethod repeat javascriptrepeat element javascript repeat javascri 5btrepeat method javascritwrite a function called repeat 2c which accepts a string and a number and returns a new string with the string repeated that number of times repeat method in javascriptstring multiplication jsrepeat string function javascriptrepeat strings x number of times javascripthow to repeat a javascript functionhow to use repeat in javascriptmake a fxn repeat jsrepaet command in jsjavascript replicate stringhow to repeat a character in jacascriptjs repaet console logvar repeatedstring 3d 22 22 3b while 28times 3e 0 29 7b repeatedstring 2b 3d string 3b times 3b 7d return repeatedstring 3brepeat javascript w3schoolshow to multiply string in reactstring times string in jsrepeater javascriptstr repeat jsstring repeat jshow to print out string 6 times in javascripthow to multiply string in javascriptrepeat ts functionjavascruipt repeatduplicating a string jsjavascript repeat methodconcat single character muiltiple times javascriptmultiply character jshow to code a repeating 2a in jsjavascript how do you repeat a functionbasic algorithm scripting 3a repeat a string repeat a stringjavascript repeatstr repeat javascriptrepeat js functioncharacter repeat javascriptjavascript repeat 28 29string repeat loop in javascriptrepeat method with template string in jsrepeated string jsmutliply string jshtml repeat stringrepeated string algorythm javascriptjavascript repeat character in stringhow to return a string multiple times jsstring repeat