repeat method

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

showing results for - "repeat method"
Isabel
14 Aug 2016
1var a="a";
2var aaa=a.repeat(3); // "aaa"
3
Linus
11 Feb 2019
1
2var str = "Hello world!";
3
4 str.repeat(2);
5 
Ilaria
03 Jan 2020
1"$".repeat(
Josefa
14 Jul 2018
1let labels = [];
2repeat(5, i => {
3  labels.push(`Unit ${i + 1}`);
4});
5console.log(labels);
6// → ["Unit 1", "Unit 2", "Unit 3", "Unit 4", "Unit 5"]
Juan David
05 Feb 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
repeat 28 29 jsjs repeat character n timesjs char repeathow to repeat an action in javascriptrepeat string in javascripthow to mutiply a character in javascript consolejavascript print character n timesrepeatnodejs string repeatjavascript add multiple characters to stringstring repeat methodjavascript repeat string infinite timesjavascript repeahow to repeat code in javascriptrepeated characters in string by position javascripthow to repeat character in string javascripthow to repeate a letter with for loop jsrepeat function javascriptduplicate string javascriptjs repeat character based on positioncreate string of repeated characters javascriptjavascript repeat 28 29repeat a char x times javascriptfunction to repeat characterss by number in jsstrings repeat repeat in javascriptduplicate string jsrepeat for variable number of times javascriptstring from repeated character jsjs repeatmultiply string jsjs repeat charsrepeat command javascriptjavascript strings how to add a character i timesstring repeathow to replicate character in javascriptjavascript repeat string n timeshow to repeat a function in javascripthow to use repeat in javascripthow to repeat a string in python javascriptrepeat something in javascripthow to repeat a character in jacascriptconcat single character muiltiple times javascriptrepeat methodm repetiion javascript repeat until n length javascriptjs make a strig with repeated charsmaking a string filled with strings javascriptjavascript replicate stringjavascript string repeatjs create string of lengthnode js multiply stringsjavascript repeat character n times in stringrepeats node jsrepeating text in javascriptfunction to repeat a string javascript multiply stringjavascript multiple stringjavascript repeat charactertypescript repeat characterhow to repeat stringjavascript repeat wordhow to multiply characters in javascriptjs how to repeat a string in a different fieldrepeat method javascriptrepeat java scriptjs multiply stringjavascript string char repeat how to repeat string in javascriptwrite out a string multiple times javascriptrepeat string function javascriptjavascript code in script repeatstring repeat function in javascriptwhat does string times string do in jsrepeat javascriptjavascript string repeat documentation e2 80 9dprint a symbol x amount of times in javascriptstring repeat 28 29js equivalent str repeatjavascript repeat character n timesrepeat string using repeat built in functionrepeat string character javascripthow to print out string 6 times in javascriptrepeat to ednt of string jsjavascript repeat a charachterrepeat number according to position javascriptjavascript repeat charactershow to repeat a function in jsrepeat character in string in javascriptrepeat meaninghow to return a string x amount in javascriptrepetition of word javascriptjavascript multiply string by numberrepeat method in javascriptrepeat a string in javascriptjavascirpt insert charanter nuber of timesjavascript string repeat characterprint a varable n times javascroptrepeat 28 29 javascriptstring repeat mdnjavascript duplicate stringjs print multiple of a stringrepeat numbers from 1 to 10 in js as stringjs multiply stringsprototype object repeatjavascript multiply string by integerjavascript repeat something in amount of timehow to make a string repeat jsmultiply string in jsjs string duplicatejs object repeatrepeat character in jsrepeat stringjavascript multiply charactershow to make a function repeat in javascriptjs repeat repeat jshow to repeat a character a number of times in javascriptrepeat loopjavascript multily letterjs multiply lettersstring repearhow to repeat letter in jsrepeat method javascritjs 2c repeat stringhow to write a function instead of repeat in javascriptreapeat string jsjs return string 3 timesstring repeatrepeat 28 29javascript generate string of charactersjs fill string multiply string javascriptjavascript repeathow eleminate the character repeat in javascriptstring repeat with delimiter javascriptrepeat string javascriptrepeat element in string based on position javascriptrepeate stringrepeat stringstring multiplication javascriptrepeat character javascriptduplicating a string in javascripthow to repeat a string jsjavascript repeat charachterrepeat a certain character nodejsrepeating stringrepeat string typescriptmutliply string javascriptrepeat a character x amount of times in a string jshow to repeat each character in a string in javascriptjs repeat charmultiply character javascriptstring repeat 28 29 mndhow to find a repeating substring in a string javascriptmultiplying string javascriptjavascript repeat a charrepeat addition of str jsrepeat js stringrepeat string char in javacriptstring repeat javascriptjavascript repeathow to use str repeat 282 29 in jsprint n character of same number jshow to repeat loop in table format replace keyword in jquerymultiply a string a number of times javascriptjavascript generate long stringrepeat a stringhtml repeat stringjavascript method for multiplying string charactersstring method for repeathow to print something repeatedly in javascriptstring repeat onlinejavascript string repeat documentationmdn string repeat 28 29string repeat 28 29 maxjs string repeat charstring cannot repeat javascriptmake a fxn repeat jsjavascript join string x timesconcatenate string number of time javascriptrepeat js 5chow to repeat a string in javascriptrepeat ts functionmultiple string length jsrepeat char javascripthow to repeat a string i jsrepeating a string in javascriptrecurring javascriptrepeat mdnjavascript string repeat n timesjavascript repeat same codestring repeat javascriptjavascruipt repeatstr repeat jsrepeat a string jsrepeat a string javascriptstring repeat until particular length javascriptjs how to represent 3 repeatingrepeat a string repeat a stringrepeat string infinite javascriptstringrepeatstring repeaterjavascript reapeat stringnodejs repear texttypescript repeatmdn repeathow to repeat in javascriptstring method that repeats char n times jsstrint repeatmultiply a char javascripthow to repeat something in javascriptjavascript string multiplicationhow to repeat a console by length in jsmake a letter repeat in javascriptdouble string jshow to repeat only one letter in string javascriptcharacter repeat javascripthow to make a repeat in jsrepeat jsjavascript repeat character x number of timesmultiply the same string javascriptmultiply strings javascripthow to code a repeating 2a in jsjavascript repeat spacerepeat string twice javascriptadd string number of time javascriptstr repeat 28this 29repeat string jsreapeat a string till it is n length javascriptrepeat elementsmdn reapeatstring repeat 28javascript repaet 22 24 22 repeatjs repeat stringjs repeat a string n timesrepeat in javascripthow to repeate same function in javascriptstring repeat 28 29 mdnjavascript repeat character in stringrepeat javascript multiple repeat js number of timesjavascipt repeathow to know repeat character jshow to repeat i times in javascripthtml write a string multiple timesmultiply character jswhat to use instead of repeat 28 29 js 24 22 repeatstring fill jshow to make a word repeat in javascriptreapeate stroingduplicate a string javascriptadd char to string n times jsnodejs repeat string contenthow to multiply strings in jsrepeat a string n characters long javascripttypescript print value x timesmake code repeat javascripthow do you multiply a string javascriptjavascript how to make a saying repeat 20 timesmapstring fill jsjavscript repeatnmultiply strings javastriptrepaet jsmutliply string jsjs concatenate strings number of timesjavascript repeate js repaet console log repeat 28 29repeat javascript functionhow to multiply str in jsjavascript repeat stringrepeat a string n times javascriptmultiply a charachter javascriptjavascript string repeated charactersstring multiplication in javascripthow to repeat a character in javascriptjavascript repeat functionjavascript string 2a8 timesstring repeat jsjavascript repeat method mdnjs repeat string n timesjs repeat character x timesjavascript string repeatstring repeat jsrepeat character jslog a string x times jshow to repeat characters in javascriptjs string repeterepeat a string in jsonline string repeatstring constructor javascript repeat characterjavascript strings multiplyrepeat a character n times javascriptrepeat functionrepeat a character jsconvert repeating index to number jsjavascript string of repeated characters object numberstr repeat javascriptmultiply strings in javascriptjs repeat space tumesrepeat function exampleshow to print a string only one time javascriptrepeat n 28xx 29 5b30 5d in javascriptrepeat character in javascriptcan avalues repeat ina set js repeatjs repeated stringrepeat characters in a string javascriptstring times string in jsstring repeat javascriptrepeat a string n time nodehow to make a js code repeatmdn string repeatstring repeat javascript documentation mdnstring repeatrepeat character in string javascripthow to repeat a stringjs multiply string by numberjavascript create string of x charactersjs string repeatstring repeat ajvascripthow to multiply a string in javascriptrepeat action jsstring repeat javascript behind the scenesrepeat 28 functioncheck repeat time in string jsjs string multiply repeat javascriptrepeat a functionjavascript repeat charstring repeat jsstr repeatjavascript repeate charhow to repeat string in javascript without repeat funsitonrepeat charachter for very long timesmultiply char and number javascriptjs repeat string infinately repeat 280 29js print string n timesrepeat letter javascripthow to repeat a diger dew times js repeat 28 29 javascriptrepeat method on stringsreturn one string that is the given string repeated n times javascriptscopy string num times jsjavascript repeat methodjavasxript repearstring repeatrepeat string n times javascriptmultiply strings jshow to repeat code in javascript for spammingobject repeathow to repeat the character in string in javascript repeat 287 29 in jsmultiple string javascriptstring prototype repeat discord jstypescript append string times 2string repeat methodmultiply a string javascript repeat methodmultiply string in javascriptjavascript repeat 0mdn string repeat 28 29 repeat in jsstring multiplication jjsjavascript string of repeated charactersrepeat method