lesson-cover

Go Back

Variables & Functions

Delay 1 and 2

Write a function called solution that takes in 2 parameters, a number and a function.

  1. solution should execute the input function (which returns a number) after first input parameter milliseconds.
  2. The input function should be run again after waiting the returned number of milliseconds
solution(2000, () => {
  // This function will be run 2000ms after solution is called,
  //   and after that, it will be run after another 3000ms
  console.log('hello')
  return 3000
})