timoxley / functional-javascript-workshop

A functional javascript workshop. No libraries required (i.e. no underscore), just ES5.
2.06k stars 441 forks source link

High Order Functions never passes #128

Closed rhberro closed 8 years ago

rhberro commented 8 years ago

I wrote these lines of codes and it worked, but now when i try to do it again it fails!

Code

function repeat(operation, num) {
    if (!num) {
        return false;
    }
    operation();
    return repeat(operation, --num);
}

module.exports = repeat;

Results

functional-javascript verify high-order-functions.js 
------------------------
Called function 1 times.
Called function 2 times.
Called function 3 times.
Called function 4 times.
Called function 5 times.
Called function 6 times.
Called function 7 times.
Called function 8 times.
Called function 9 times.
------------------------
Called function 1 times.
Called function 2 times.
Called function 3 times.
Called function 4 times.
Called function 5 times.
Called function 6 times.
Called function 7 times.
Called function 8 times.
Called function 9 times.

# FAIL

Your solution to Higher Order Functions didn't pass. Try again!
blrobin2 commented 8 years ago

I'm having the same problem. I even copied and pasted the solution from the repo as a test and it fails.

timoxley commented 8 years ago

@rhberro @blrobin2 looking into fixing this but I think the problem is that you're unnecessarily returning false.