The first problem is in the following line in which you tried to access keys with dot notation and a variable. Try to console.log(collection[i].pre) and you’ll see nothing printed to the screen.
It should be replaced with collection[i][pre].
The second problem is with the IF statement in which you tried to test multiple values against collection[i][pre] as a group. That will not work.
You should test it against each value, which means that you’ll have to repeat writing collection[i][pre] multiple times.
Example …collection[i][pre] == "" || collection[i][pre] == false || collection[i][pre] == 0… etc.
That is too much writing, isn’t it?
There’s a quick way to convert the values into truthy and falsy values and then based on that you can filter the result and return the right string.
This doesn’t mean that your method is wrong. It only means that you will write a lot of lines in order to get to the solution.
Don’t hesitate to ask more questions.
I will be glad to help.
Thanks a lot. You’ve been a great help. Could i contact you directly in the future when I need help? I was facing huge problems understanding recursion and I literally had to copy and paste stuff in a couple of challenges to pass.