London10 - Afsha Hossain - JS Core 1 - Week 2#438
London10 - Afsha Hossain - JS Core 1 - Week 2#438Afsha10 wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
| return "You Can Register"; | ||
| } else if (age >= 90) { | ||
| return "You Don't Need To Register"; | ||
| } else { |
There was a problem hiding this comment.
The last statement that returns false is not required. recommend to delete the last else statement as the first 3 conditions already covers all the cases you can have.
function canRegister(age) {
if (age <= 12) {
return "You Are Too Young To Register";
} else if (age > 12 && age < 90) {
return "You Can Register";
} else {
return "You Don't Need To Register";
| return price2; | ||
| } else price1; | ||
| } | ||
|
|
There was a problem hiding this comment.
Agreed, good job 👍
It's good that you're thinking about the case where price1 is equal to price2.
| @@ -10,20 +10,18 @@ | |||
|
|
|||
| */ | |||
|
|
|||
There was a problem hiding this comment.
Both of these look good to me 👍
| @@ -4,7 +4,13 @@ | |||
| 1. the user should be 18 or older | |||
| 2. the user must be logged in | |||
| */ | |||
There was a problem hiding this comment.
Nice 👍
Can you think about how you can make this code even shorter? Do you need the if statement? Can you do it with only a return statement?
| */ | ||
| function printOddNumbers(limit) {} | ||
|
|
||
|
|
| @@ -45,7 +85,12 @@ function canRegister(age) {} | |||
| ) | |||
| */ | |||
|
|
|||
| @@ -10,6 +10,16 @@ | |||
|
|
|||
There was a problem hiding this comment.
Looks like there's a lot going on here 😄
For problems like this, I would suggest we take a step back from the code - and think about some of the Problem Solving techniques we covered in the workshop in class. Maybe start by thinking about how you would normally do something like this (without a computer) and try drawing it out on a whiteboard or paper. This may give you some ideas about how to do this in code.
There was a problem hiding this comment.
Well done for attempting this though! It's a tough one!
There was a problem hiding this comment.
I wrote pseudo code and watched your videos on function and looping and managed to do this on my own in less 30 minutes. Thank you, Barath!
|
Good job on this coursework @Afsha10 👍 |
Completed the extra part on my own after writing the pseudocode and watching Barath's function and looping videos.
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?