Callback function drill

We’re going to have to do some of our database update operations lots of times. Write a function callNTimes that takes in two arguments: a number and a callback function.

callNTimes should call the callback function the number of times.

My failed attempts

const callNTimes = (num, callback) => { callback(num)}

const callNTimes = function(num, callback){
  return callback(num)

const callNTimes = function(num, callback){

function callNTimes(num, func){

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

  • Why do you have the callNTimes function so many times?

  • You are not using the num parameter.

  • If you need to do something again and again, what would you use?

  • If you needed to do it n times how would you use n?

Hello ! thanks, first time here. I’m in a coding bootcamp at thinkful and this is a drill in … I should’ve clarified these are multiple individual attempts… num is being used in test parameters… as shown here

Test Results:
 calls the callback 2 times when passed '2'
expected { Spy, 1 call } to have been called 2 times but got 1
Completed in 2ms
 calls the callback 1000 times when passed 1000
expected { Spy, 1 call } to have been called 1000 times but got 1