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

Add lesson for Loops in Javascript #101

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add lesson for Loops in Javascript #101

wants to merge 9 commits into from

Conversation

char-adadev
Copy link

The purpose of this PR is to add a lesson detailing out several looping mechanisms in Javascript.

For review:

  • Please use learn preview to review the curriculum
  • Review for correctness of material
  • Any grammar or wording updates
  • Anything missing or any additional material recommended

Copy link
Collaborator

@kyra-patton kyra-patton left a 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!

learning-another-language/js-loops.md Outdated Show resolved Hide resolved
learning-another-language/js-loops.md Outdated Show resolved Hide resolved
learning-another-language/js-loops.md Outdated Show resolved Hide resolved
learning-another-language/js-loops.md Outdated Show resolved Hide resolved
Comment on lines 8 to 10
### 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.
Copy link
Collaborator

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.
Copy link
Collaborator

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 💫

learning-another-language/js-loops.md Outdated Show resolved Hide resolved
learning-another-language/js-loops.md Outdated Show resolved Hide resolved
learning-another-language/js-loops.md Outdated Show resolved Hide resolved
// ['Hello, Auberon', 'Hello, Char', 'Hello, Claire', 'Hello, Kyra']
```

### break
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants