showing results for - "repeat string using repeat built in function"
Mira
17 Aug 2020
1
2var str = "Hello world!";
3
4 str.repeat(2);
5 
Kevin
12 Jan 2017
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
string repeat onlinejavascript repeat function repeat 287 29 in js 24 22 repeatrepeat numbers from 1 to 10 in js as stringjs repeatjavascript repaethow to repeat a stringstring repeat 28 29 maxjs repeat a string n timesrepeat loopjavascript repeat something in amount of timehow to write a function instead of repeat in javascriptjs print multiple of a stringjs return string 3 timesrepeatin stringhow to print a string only one time javascriptjavascript string repeatmdn string repeat 28 29 repeat a stringjavascript repeat same coderepeat javascriptrepeat string withadd string number of time javascriptstring repeat jsstring repeaterrepeat functionrepeat number according to position javascriptjavascipt repeathow to repeat a character in javascriptrepeat a functionrepeat element in string based on position javascripthow to repeat loop in table format replace keyword in jquerywhat to use instead of repeat 28 29 jsstring repeat javascriptjs multiply string by numberstring repeat 28 29 mndjs repaet console logmultiply the same string javascriptprototype object repeathow to mutiply a character in javascript consolehow to print out string 6 times in javascriptstrint repeatrepeat js stringjs string multiplyjavascript multiply string by integerfunction to repeat a string js string repeterepeated characters in string by position javascripthow to repeat a diger dew times jshow to find a repeating substring in a string javascripthow to code a repeating 2a in jsrepeat 28 functionmultiply string jsstring repeatjs repeat charhow to multiply str in jsstr repeatstring repeat until particular length javascriptm repetiion javascriptrepeat stringshow to make a word repeat in javascripthow to repeate same function in javascriptjs create string of length repeat 280 29 repeat until n length javascriptstring repeat jsstring repeat with delimiter javascriptrepeats node jsprint n character of same number jsrepeat a string repeat a stringrepeat action jsduplicate string javascriptrepeat a string in jsjavascript repeat character n times in stringstring repeatrepeat to ednt of string jsstring repeathow to print something repeatedly in javascriptreapeat a string till it is n length javascripthtml repeat stringrepeat a certain character nodejsrepeat string javascriptcheck repeat time in string jshow to repeat something in javascriptobject repeatnodejs repear textjavascript string multiplicationhow to repeat only one letter in string javascriptjs object repeatrepeating text in javascriptrepeat character in string in javascriptrepeat for variable number of times javascripthow to repeat stringsstring repeat ajvascriptstring repeat 28 29repeat function examplesrepeat string using repeat built in functionjavascript repeat characterhow to repeat i times in javascriptjavascript multiply string by numberjs how to represent 3 repeatingrepeat methodjavascript string of repeated characters object numberrecurring javascripthow to repeat a function in jsjs multiply lettersrepeat something in javascriptrepeat in javascriptrepeat command javascripthow to use repeat in javascriptmaking a string filled with strings javascriptrepeat function javascriptrepeate stringstring multiplication in javascriptstring repeatjavascript generate long stringhow to repeat in stringhow to repeat stringjavascript string of repeated charactershow to make a js code repeat repeat 28 29how to make a function repeat in javascriptstring repeat methodrepetition of word javascriptstring method for repeathow to repeat an action in javascriptjs make a strig with repeated charsjavascript reapeat stringstring repeat methodjava repeat 28 29repeat 28 29 javascriptonline string repeatrepeat method javascriptstrings repeatjavascript create string of x charactersreturn one string that is the given string repeated n times javascriptsjavascript repeatjavascruipt repeatrepeat string infinite javascriptrepeat stringhow to repeat a function in javascriptjavascript method for multiplying string charactersnodejs repeat string contentmake code repeat javascriptrepeat string twice javascriptjavascript repeatrepeat string using repeat built in function