Glasgow class 6- Yesna Omar- JavaScript- week 2#448
Glasgow class 6- Yesna Omar- JavaScript- week 2#448Yesna-Omar wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
gregdyke
left a comment
There was a problem hiding this comment.
Very nice work. Maybe you can take some time this Saturday to work on my comments?
| let isBigEnough; | ||
|
|
||
| if (isBigEnough) { | ||
| num == 10; |
There was a problem hiding this comment.
Can you tell me what you think this line does?
| */ | ||
| function isAcceptableUser(userAge, isLoggedIn) {} | ||
| function isAcceptableUser(userAge, isLoggedIn) { | ||
| userAge == 18; |
There was a problem hiding this comment.
Again, you have this same coding pattern. What does it do?
| userAge == 18; | ||
| if(userAge >= 18 && isLoggedIn){ | ||
| return true; | ||
| }else{ |
There was a problem hiding this comment.
You seem to not have format on save turned on (or it is conflicting with your auto-save?). Could you work with your buddy or a volunteer on Saturday to fix this?
There was a problem hiding this comment.
I am experiencing the same problem even though my format on save option is turned on. I will take a look at it on Saturday to see if I can fix it with volunteers help
| function applyDiscount(totalPrice) {} | ||
| function applyDiscount(totalPrice, discount) { | ||
| if (totalPrice >200) { | ||
| total= totalPrice-(totalPrice*0.1); |
There was a problem hiding this comment.
total should be defined with let or const
| total= totalPrice-(totalPrice*0.1); | ||
| return total; | ||
| } else if (totalPrice < 200){ | ||
| total=totalPrice-(totalPrice*0.05); |
There was a problem hiding this comment.
These two lines occur twice. Can you see how if you had a new user requirement (for example, to add some rounding), you would need to change your code in 2 places. Could you rewrite this code to make it less verbose?
| function canRegister(age) { | ||
| if (age <= 12) { | ||
| return "You Are Too Young To Register" | ||
| } else if(age > 12 && age <90){ |
There was a problem hiding this comment.
do you need to write age > 12 in this line? What would happen if you remove it?
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