Var a="ani".repeat (function (){return 3}) console.log(a) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Var a="ani".repeat (function (){return 3}) console.log(a)

Why I got nothing??

22nd Aug 2021, 6:39 AM
Aniket Ganguly
2 Answers
22nd Aug 2021, 7:02 AM
Ipang
0
Aniket Ganguly Instead of a function put the number of times you want your string to be repeated as the parameter: var a = "ani".repeat(3); // "anianiani" console.log(a); Output: anianiani
22nd Aug 2021, 7:51 AM
Maisu
Maisu - avatar