let string = 'Plumbus' let count = 3 string.repeat(count); // -> 'PlumbusPlumbusPlumbus'
var a="a"; var aaa=a.repeat(3); // "aaa"
let myString = 'test'; myString.repeat(3); // 'testtesttest'
function repeatStringNumTimes(string, times) { var repeatedString = ""; while (times > 0) { repeatedString += string; times--; } return repeatedString; } repeatStringNumTimes("abc", 3);