lesson-cover

Go Back

Variables & Functions

Call function X Times

Write a function called solution that takes in 2 parameters, a number X and a function, and calls the function X number of times and then returns null.

Basically, solution should run the user provided function X times.

solution(88, () => { console.log('hello') }) // 'hello' should be printed out 88 times.

solution(9, () => { alert('hello') }) // alert('hello') should be ran 9 times.

Reminder for students with prior experience: you are not allowed to use for and while loops. Reason