is there any short code to repeat a function n times ?
Hello ,
To repeat getCompetenceLogs() function 3 times I use this bellow ,
for (let i = 0; i < 3; i++)this.getCompetenceLogs();
I'm wondering if there is in javascript another way to repeat function N times ?
thanks
@mostafalaravel
Instead of calling the function repeatedly, you could consider changing the function to accept an argument for the number of repetitions.
this.getCompetenceLogs(3);
function getCompetenceLogs(times = 1)
{
for (i = 0; i < times; i++)
{
...
}
}
Please or to participate in this conversation.