-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Teach unreachable code and scope in separate lessons for pyramid project #54809
Comments
ugh, I just saw step 52. I don't understand why step 51 would -implicitly- suggest that a person should create a new variable after the return only to point it out as wrong in the next step. step 51 should show us that a 'correct' declaration of the variable in a local scope will result in a ref. error when the variable is referenced beyond that scope. As for teaching people not to put code after the return, that should be a -separate- and -unrelated- step in this case. on the other hand, step 51 could -explicitly- tell people to put the new line of code after the return only to point out it is incorrect in step 52. At least this way, if a person knows enough to type it in correctly, step 51 could fail and make them type it into the wrong spot? (or just scratch this and take my original suggestion of fixing step 51 and teaching about not writing code after returns separately) |
I agree, it seems like an odd choice. Unreachable code and variable scope should be taught separately. |
@naomi-lgbt or @Ksound22 ? Are either of you free to make these updates? I don't want to open a PR right before I go on vacation. Thanks 👍 |
Can we open it up for contribution? |
I'd prefer to see the instructions updated to specify putting the variable after the return - I think it's valuable information to teach. |
This is the first time campers will be taught about variable scope. They may have coded for less than half a day. Adding unreachable code as part of teaching variable scope can muddy the water for the learner, where they may end up making a correlation between the two that doesn't exist. I would suggest we split it up into separate steps that focus on each topic. |
I could work with that, yes |
Describe the Issue
on starting step 51 of the JS Beta project to build a pyramid generator, I noticed that we're being asked to add a variable declaration and that the editor has an empty line within the padRow function but -after- the return statement. As these blank lines are meant to be suggestive to learners (nudging them as to where to type), this empty line after the return seemed to be badly placed as it shouldn't suggest that placing code after a return statement is acceptable (or that it could work with the console log in the local scope for eg which also would not work in this case)
Suggest to place the empty line within the function above the return statement instead.
Affected Page
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-introductory-javascript-by-building-a-pyramid-generator/step-51
Your code
N/A
Expected behavior
empty line within padRow function should be placed above the return statement (not below it)
Screenshots
No response
System
N/A
Additional context
No response
The text was updated successfully, but these errors were encountered: