Bone to pick with recursion module

I finally completed the last module on recursion, but I don’t feel any better for it. Even after thinking I understood the concept of recursion fairly well after some well-worded expliantions, I became stumped on this one because of the way it’s structured. I employed the help from a co-worker who is very knowledgeable in code to give me some hints to finish it. He knew how to “solve” it, but even he was confused at some parts as well.

The problem is the solution isn’t even viable code and will produce errors if you try it in an actual code editor. The confusion came with the myArray function parameter. It’s required to be in the function and in the function call unchanged, which threw me. I spent a lot of time trying to figure out what to do with it in my function. Ultimately, you need to do nothing.

This is mainly just feedback, but this is the worst kind of challenge. A challenge where the student is forced to produce code that isn’t valid and they don’t understand will only serve to undermine their confidence and learning. Maybe others had a better time at this challenge, but I was perturbed pretty heavily by this one.

the challenge is being rewritten in this pull request, feel free to contribute with your feedback:

1 Like

Awesome! Great to hear.

I had a look at the challenge and I find it very simple and correctly implemented.
The solution is very basic if you understand closure and the concept of recursion.
I understand that for a beginner it will be challenging, but that is the purpose of it.

This challenge was excellently written from description to execution.

I thought this can help so I have written a pseudo solution (I hope this is not going to be treated as spoiler):

function countdown(myArray, n){
    if variable n greater than 0
        push n to the array myArray
        subtract 1 from n
        call recursively countdown with closure over the array myArray and integer n via lexical scope
    else
        return array myArray;
}