Write a function called makeSafeInterval(func,interval)
, which sets up an interval that executes func
every interval
seconds, stopping the first time func
throws an error.
makeSafeInterval(func,interval)
should take a function and interval (in ms) as argumentsmakeSafeInterval(func,interval)
should return a function that can be called with additional arguments- makeSafeInterval should execute
func
everyinterval
seconds. HOWEVER, the first time func throws an error, it should stop.