Skip to content
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

Open
hbar1st opened this issue May 15, 2024 · 7 comments · May be fixed by #54920
Open

Teach unreachable code and scope in separate lessons for pyramid project #54809

hbar1st opened this issue May 15, 2024 · 7 comments · May be fixed by #54920
Labels
help wanted Open for all. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@hbar1st
Copy link
Contributor

hbar1st commented May 15, 2024

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

@hbar1st hbar1st added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels May 15, 2024
@hbar1st
Copy link
Contributor Author

hbar1st commented May 15, 2024

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)

@gikf gikf added the new javascript course These are for issues dealing with the new JS curriculum label May 17, 2024
@lasjorg
Copy link
Contributor

lasjorg commented May 18, 2024

I agree, it seems like an odd choice.

Unreachable code and variable scope should be taught separately.

@jdwilkin4
Copy link
Contributor

@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 👍

@Ksound22
Copy link
Member

Ksound22 commented May 20, 2024

@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?

@Ksound22 Ksound22 added status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. and removed status: discussing Under discussion threads. Closed as stale after 60 days of inactivity. labels May 20, 2024
@naomi-lgbt
Copy link
Member

I'd prefer to see the instructions updated to specify putting the variable after the return - I think it's valuable information to teach.

@lasjorg
Copy link
Contributor

lasjorg commented May 20, 2024

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.

@naomi-lgbt
Copy link
Member

I could work with that, yes

@jdwilkin4 jdwilkin4 added help wanted Open for all. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels May 21, 2024
@jdwilkin4 jdwilkin4 changed the title location of empty lines on step 51 of the JS (Beta) Pyramid project seems wrong Teach unreachable code and scope in separate lessons for pyramid project May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. new javascript course These are for issues dealing with the new JS curriculum scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants