0
Var a="ani".repeat (function (){return 3}) console.log(a)
Why I got nothing??
2 Answers
0
The method accepts a numeric value, not a function
https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/string/repeat
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