-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add lesson for Loops in Javascript #101
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like how thorough this is!
I left a lot of comments about updating the formatting of the lesson to match that of other Learn lessons. I think that's probably a conversation we want to have with Bethany and/or the larger Education Team... there used to be a document that outlined style guidelines for curriculum, but the link I have for it is broken.
Also left some comments about content I think could be condensed and/or expanded upon based on my understanding of where folks are in their learning journey when they are assigned this lesson.
Amazing first draft!
### What is a loop? | ||
|
||
Loops are used to perform repeated tasks based on a condition. A condition is a statement which can evaluate to either **true** or **false**. A loop will continue running until the condition returns false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lesson is at the top of Unit 3, so folks should have a solid grasp on what loops are already. Consider replacing this with something that highlights how JS loops differ from what they have learned about loops thus far in Python. Perhaps something to the effect of 'Javascript has several variations of the basic for and while loop. The for
family of loops includes... The while
family includes...'
|
||
The reason for this is because the `for … in` loop iterates over **all** of the enumerable properties in an object, including any that may be inherited. | ||
|
||
If, for instance, a JS library modifies the `Array` prototype, the loop will iterate over any additional properties as well. Check out the example below for a potentially non-intuitive demonstration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure they are familiar with what a prototype is. We may need to expand on what the prototype property is. It might be enough to say the reasoning has to do with something called prototypes which are out of scope for this course, and include a link so they can follow their curiosity 💫
// ['Hello, Auberon', 'Hello, Char', 'Hello, Claire', 'Hello, Kyra'] | ||
``` | ||
|
||
### break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a paragraph on coding style and break
and continue
statements. While they can be useful, we often want to minimize their usage because they can make the execution flow unpredictable/difficult to follow.
Co-authored-by: Kyra Patton <[email protected]>
The purpose of this PR is to add a lesson detailing out several looping mechanisms in Javascript.
For review: