freeCodeCamp / freeCodeCamp

freeCodeCamp.org's open-source codebase and curriculum. Learn to code for free.
https://contribute.freecodecamp.org
BSD 3-Clause "New" or "Revised" License
406.23k stars 38.17k forks source link

platformer game (js beta) step 103 + 104 instructions need clarification #55824

Open hbar1st opened 3 months ago

hbar1st commented 3 months ago

Describe the Issue

There are 2 issues that need to be looked at for step 103 of the platformer game (js beta).

1- there's a context shift when we first enter step 103 as we are jumped down from line 136-138 (in the prior step) down to line 154 without any explanation. We were drawing the checkpoints in step 102 and in step 103 we are suddenly being asked to do something else "inside [our] condition". We need a short explanation of what we are doing down in line 154 (are we solving a problem? are we adding a feature? What's happening?)

2- the second issue is this part of the instructions "Inside the loop, use the subtraction assignment operator to subtract 5 from the checkpoints's x position." When I read this, I paused a bit on "inside the loop" because, what loop did this line mean? I decided to continue on and write the following code:

checkpoints.forEach(checkpoint => checkpoint.position.x -= 5);

But this code was not accepted and the hint given was: You should have a checkpoint parameter inside the forEach callback function.

So as this was not helpful, I moved on to step 104 to see what the fuss was all about and found the following:

      checkpoints.forEach((checkpoint) => {
        checkpoint.position.x -= 5;
      });

Clearly step 103 was expecting the braces so I went back and added them and at this point the step checks passed.

So this second issue then is that step 103 is not being clear enough that it wants the braces there. I think when the step said "Inside the loop" maybe it was actually trying to say "Inside the body of the callback function"?

Affected Page

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

Your code

As given above.

Expected behavior

Clearer instructions to explain why this step is asking us for this specific code and also to explicitly tell us to use the braces for the callback function body (or to not use implicit return format). Better hints would be great too when expectations are not met.

Screenshots

No response

System

N/A

Additional context

Step 104 has similar wording to step 103 and should be updated as well (though maybe if step 103 explains what we are about to do and why, then step 104 can possibly not do that too), but it will need to adjust the "Inside the loop" statement still.

msudipta888 commented 3 months ago

can you please assign me this issue

lasjorg commented 3 months ago

@msudipta888 You have already been told the rules. Now, please stop asking to be assigned in issues.


We typically do not assign issues. Instead, we accept the first pull request that comprehensively solves the issue.

Issues labeled with help wanted or first timers only are open for contributions.

Please make sure you read our guidelines for contributing. We prioritize contributors following the instructions in our guide. Join us in our chat room or the forum if you need help contributing - our community will be happy to assist you.

lasjorg commented 3 months ago

I'm fine with allowing both types of callback bodies (expression/block), i.e. making the {} optional. But if we make the block body optional in this step, it should be the same for all the steps where it would be valid syntax. The same type of forEach is written quite a few times with varying arrays/parameters.

I agree that "Inside the loop" should be "Inside the callback" or "Inside the forEach callback".

https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb472593e3be6d10a7c13b.md


I can't really speak to providing more context for the step. But I agree it seems to be missing.

mutant138 commented 1 month ago

can you please assign this issue to me

ilenia-magoni commented 1 month ago

@mutant138 this issue is not open for contribution, only issues with the 'help wanted' label are open for contribution