-1

Write a function after that takes the number of times the callback needs to be called before being executed as the first parameter and the callback as the second parameter.

1

1 Answer 1

0

This sounds a bit like a homework assignment, so I'm hesitant to help you with your homework by answering the question for you ;)

Instead ... the basic idea is that you need to write a function with two arguments:

function (numberOfTimesToCall, callbackFunctionToCall) { //..

Inside you'll call the callback argument, using:

callbackFunctionToCall();

You'll want to do that a certain number of times, and in Javascript we typically use a for loop to do something a certain number of times.

For instance, to doSomething() five times, you could write:

for(var i = 0; i < 5; i++) {
  doSomething();
}
Sign up to request clarification or add additional context in comments.

2 Comments

Glad I could help, but don't forget to accept the answer (click the checkmark next to it) if it answered your question :)
don't worry will do sir

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.