Glasgow 6 - Hussein Al-Sayed - JS - week 2#446
Glasgow 6 - Hussein Al-Sayed - JS - week 2#446hussein-alsayed wants to merge 4 commits intoCodeYourFuture:mainfrom
Conversation
| */ | ||
|
|
||
| function getMood() { | ||
| function getMood(isHappy) { |
There was a problem hiding this comment.
while you realized that you need to add the isHappy as a parameter there is still the case of variable shadowing that blocks this function to behave properly
There was a problem hiding this comment.
still trying to understand these differences and their behaviour. however i believe i fixed it now 👍
mandatory/1-fix-functions.js
Outdated
|
|
||
| function greaterThan10(num) { | ||
| let isBigEnough; | ||
| let isBigEnough = Number > 10; |
There was a problem hiding this comment.
the idea is good, however care must be taken to make sure variable names that mean the same value are named exactly the same throughout
mandatory/2-function-creation.js
Outdated
| function applyDiscount(totalPrice) {} | ||
| function applyDiscount(totalPrice) { | ||
| if (totalPrice > 200) { | ||
| return totalPrice * 0.9; |
There was a problem hiding this comment.
having proper indenting inside functions and blocks is usually a good way to make sure code is readable. You should make sure to use an editor that has auto-indenting enabled as that helps making sure everything is in order
There was a problem hiding this comment.
i'm using vsc, is there any extensions i can use for this?
mandatory/2-function-creation.js
Outdated
| } else if (price2 > price1) { | ||
| return price2; | ||
| } else { | ||
| return price1||price2; |
There was a problem hiding this comment.
If the price is the same then you can simply return whicever value
There was a problem hiding this comment.
true! I thought this way i'd be showing that i'm aware there's no difference. but i guess code length and simplicity matters more.. edited now 👍
mandatory/2-function-creation.js
Outdated
| */ | ||
| function canRegister(age) {} | ||
| function canRegister(age) { | ||
| if (age < 13) { |
There was a problem hiding this comment.
Prefer using <= and >= in case the text is defined that way to avoid differences between the specification and the solution
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?