London 9 Lovelace - Oleksii Chepurnyi - JavaScript Core1 - Week 3 - #171
London 9 Lovelace - Oleksii Chepurnyi - JavaScript Core1 - Week 3#171OleksChep wants to merge 16 commits into
Conversation
maxf
left a comment
There was a problem hiding this comment.
Excellent. Very good work. Two things:
- you can now finish the exercises you've not started
- you need to review how you use git. There are far too many commits, with no useful commit message. You need to understand that reading a git history should describe what you did, and not just be a list of 'updated' messages. In a professional environment, communicating how you write and change your code is just as important as the code itself. And git should be used towards that goal, not just as a backup system.
| return birthdays[i]; | ||
| } | ||
| i++; | ||
| } |
There was a problem hiding this comment.
Very good. You can also write it in fewer lines with find()
| } | ||
| let i = 0; | ||
| let sum = 0; | ||
| do { |
| sum = sum + i*2; | ||
| i++; | ||
| } | ||
| while(i < n ); |
| // TODO - Write for loop code here | ||
|
|
||
| /* | ||
| let i = 0; |
There was a problem hiding this comment.
you don't need to declare i here, since it's declared in the line below, in the for statement.
This could lead to future errors because now you have 2 different i variables, one outside of your for loop (which you don't need) and the one inside the for loop (which you need)
| "Canada Water", | ||
| "Forest Hill", | ||
| " " | ||
| ]; |
| */ | ||
| function potentialHeadlines(allArticleTitles) { | ||
| // TODO | ||
| return allArticleTitles.filter((items) => items.length < 65); |
There was a problem hiding this comment.
This works perfectly, well done.
Hint: the choice of variable and parameter names is important to make your code readable. Here, items doesn't really describe what it contains. For instance, it could have the value "This is the title", which isn't really an items. Instead it's just a title of an article, so it would make more sense to call it just title for example.
| let result = 1; | ||
| while (n) { | ||
| result *= n--; | ||
| } |
There was a problem hiding this comment.
This works, but some teams prefer not to use -- or ++ because they make expressions hard to understand, specifically because expressions that change the values of variables (also called expressions with side effects) are confusing. So try to rewrite this expression to move the change of n on a separate line.
There is something to work on.