Researched Issue: JavaScript Algorithms and Data Structures (Beta), "Exercise": Learn Intermediate OOP by Building a Platform Game Step 86
Describe the Issue
This exercise seems to only allow success if the word "rule" is used in the code as the Boolean "truthiness" test. However, this word appears nowhere in the code (html, css, js) and it is not indicated that it is a key word for exercise success by being stylised as code. I looked up several articles on .every and several articles on boolean and truthiness and those throw you off further. I even tried to see if "rule" appeared anywhere in code, as mentioned.
Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-86
Your code
if (collisionDetectionRules.every((word "rule" required here) => //word "rule" required here//) { player.velocity.y = 0; return; }
Expected behavior
There is already a forum post on this particular exercise: it was misleading to me in the same way to have to guess that "rule" would mean something in the code when it hasn't up to that point and doesn't appear in code. Forum post link here:
https://forum.freecodecamp.org/t/solution-explanation-learn-intermediate-oop-by-building-a-platformer-game-step-86/677128
Screenshots
No response
System
Not critical to this particular error, but M2 Mac running Sonoma 14.4. Safari browser.
Additional context
This is unnecessarily wasting users' time. Folks helping in forum seem to indicate the word choice here "fits," but if writing own code, the word could be chosen. Seems the code or help messages are too strict here.
Proposed Solution: Indicate in error feedback that word "rule" is critical to success of this exercise even though it doesn't appear in code yet. And maybe indicate in one's own code that this Boolean test could be called any number of things.
Thank you for reporting this issue.
There isn't any strict requirement for the parameter name of the callback function. It's not required to use rule, test will allow literally and figuratively anything:
if (collisionDetectionRules.every(anything => anything)) {
player.velocity.y = 0;
return;
}
Could you double check this?
After checking, it does look like you are correct. It does seem I am the one who made an error. I guess I confirmed my bias with the other student's forum post and didn't investigate further. I cannot reproduce my mistake and it does seem the test works correctly.
Perhaps it is the nature of this particular aspect of Javascript, but it nevertheless does not seem intuitive that I can use rule (which doesn't appear in my code) or any other word (that I haven't previously referenced).
I may not know enough to drive a solution, but perhaps there is still a wording issue or order of introduction of this topic issue. I would have to review much further in the future.