All or Nothing explainer

I’m not totally sure what I’m doing wrong. I’ve looked at all the feedback and I can’t figure out if there’s something in the wrong place or what.

Hey there,

The function takes a parameter, results, and loops through it, looking at each item one at a time. If one of those items is the string 'fail', the function will return the string 'failed'. Otherwise it will return the length of results.

When the function is called, it takes testResults as an argument.

In your code, testResults is being used where you should be using results. Change your for loop to this:

for (var element of results) {
    if (element === 'fail') {
        return 'failed';
    }
}

Then, at the end of the function:

return results.length + 'tests passed';

Hope this helps! Let me know if you have any questions.
Ben

Thank you! That helps a lot! I completed it.

1 Like