The first function below, does not make any calls to operation(), but is still seen as correct.
This is so even though only dashes were logged to console.
function repeat(operation, num) {
if ( num == 0 )
return
repeat(operation, num - 1);
}
The solution as supplied:
function repeat(operation, num) {
if (num <= 0) return
operation()
return repeat(operation, --num)
}
The first function below, does not make any calls to operation(), but is still seen as correct. This is so even though only dashes were logged to console.
The solution as supplied: