Modify my String so it will equal "world" 5 times help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Modify my String so it will equal "world" 5 times help

function repeatString(stringToRepeat: string, numTimes: number) { let result =" "; for(let i = 0; i < numtimes; i++) { result += stringToRepeat; } return result ; } let myString = repeatString();

2nd Feb 2017, 7:23 PM
Alejandro
Alejandro - avatar
1 Answer
+ 9
function repeatString(stringToRepeat, numTimes) { let result =""; for(let i = 0; i < numTimes; i++) { result += stringToRepeat; } return result ; } let myString = repeatString("world",5);
2nd Feb 2017, 7:29 PM
Valen.H. ~
Valen.H. ~ - avatar