Hi Ionatan,
"Creating a second variable to a value that you already have a variable referring to won’t help you."
I assume you mean for this -
let newArr = array;
"Comparing true to true results in true, and comparing false to true results in false, in both cases the result is the same as the original value so the comparison doesn’t help."
Do you mean for this -
while (predicate(array[i], i, array)===true)
Would my while loop continue if i didn’t include the === true? How will it know when to end?
"Your code doesn’t check for end of the array. It may continue forever."
Is this really an issue? won’t an array come to an end eventually? Have you seen examples otherwise?
"What makes you say the other code more complicated?"
Of course, in the bigger projects these few lines of code difference is nothing, since I’m starting off I find that when the instructor creates another function (cb), then uses findIndex, and then another variable called droppedArray it seems all excessive.
Even in the codecademy description it says -
"Congratulations! This method wasn’t especially long, but it used a lot of advanced concepts. Great job working through it!"
Which is why I wonder if I’m supposed to use advanced concepts.
"You also modify the original array and I’m not so sure the result is right at all, have you tested it, seen it actually produce the right result for non-trivial input?"
In terms of the node test that occurs in the codecademy panel, it runs with everything passing. So that’s why I’m confused. Shouldn’t there be more parameters to check? or maybe the codecademy node check is enough…