garageScript / curriculum

GarageScript Curriculum
21 stars 163 forks source link

JS1 Problem 12: No test case for infinite function calls #342

Closed Oroul closed 4 years ago

Oroul commented 4 years ago

There is no test to ensure the function is called only two times, so the following code will pass tests when it probably shouldn't:

const solution = (a, fun) => {
  setTimeout(() => {
    solution(fun(), fun)
  }, a)
}