Possible BUG: Intermediate OOP/Platformer Game Step 23 doesn't accept fCC-provided correct answer

Problem:
Task reads " Create an empty if statement that checks if the sum of the player’s y position, height, and y velocity is less than or equal to the height of the canvas."

Writing either

if(this.position.y+this.velocity.y+this.height <= canvas.height);

or

if(this.position.y+this.velocity.y+this.height >= canvas.height);

won’t work. But if I load the next step, it shows the first option as the correct answer (even though copying it from Step 24 and pasting it in Step 23 won’t work)

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-intermediate-oop-by-building-a-platformer-game/step-23

Figured out the cause: the page expects the parameters for the if() statement to be written in a specific manner (position — height — velocity), even though any order should work.

(please let me know if these posts/error reports are not the preferred method for reporting issues: since the revamped Javascript course is in beta, I figured I would be helping out if I provide feedback on any issues I find)

2 Likes

It is better to report it on the issue tracker. But this works as well.

You are correct that the order shouldn’t matter. Or if it does it should specify as much.

A fixed order makes it easier to test so that is fine, but it should be clear that the order is part of the requirement.

that checks if the sum of the player’s y position, height, and y velocity (in that order) is less than or equal to the height of the canvas.

2 Likes

Got it, I’ll use the issue tracker next time. Thanks!