Implement the filter Method on a Prototype Explanation

Implement the filter Method on a Prototype Explanation
0

Tell us what’s happening:
Using the solution from the hint in the challenge, I know my code works and I was able to pass. But, I am confused as to the solution itself. Can someone please explain this code to me? I want to recreate my own code for this challenge before moving on.

The specific line of code that I am stuck on utilizes the callback function in the if statement.
if (callback(x) == true) I believe if I can clarify this line I will be able to understand the remaining lines of code I am struggling with.

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype

In the future, instead of posting the solution you found in the Guide, just reference the solution in specific solution (Basic, Intermediate, or Advanced). This prevents users who are searching for help from just seeing the solution in a topic.

Also, instead of us explaining every line of the solution, it would be better for you to tell us which parts you do not understand. There is no reason for us to explain something which you already understand.

Thank you.

I have edited the post to ensure the solution code is removed and highlighted one specific line where I am stuck. Thanks so much for the advice, I will make sure not to repeat the same mistakes!

in the filter method the callback returns a boolean (true or false) and keeps the value if it is true, and doesn’t keep the value if it is false

that if statement is checking if the value returned from the callback is true and if it doing something