Js repeat a function by for loop

mrjahid

JAHID

Posted on February 15, 2022

Js repeat a function by for loop

Syntex:

const hi = function () {
 console.log('Hi! You Are Welcome !!');
};
function repeat(func, num) {
 for (let i = 0; i < num; i++) {
 func();
 }
}
repeat(hi, 2);

💖 💪 🙅 🚩
mrjahid
JAHID

Posted on February 15, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related