-
-
Notifications
You must be signed in to change notification settings - Fork 437
London10 - Afsha Hossain - JS Core 1 - Week 2 #438
base: main
Are you sure you want to change the base?
Conversation
return "You Can Register"; | ||
} else if (age >= 90) { | ||
return "You Don't Need To Register"; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well done Afsha .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Navid!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, good job 👍
It's good that you're thinking about the case where price1
is equal to price2
.
NOTE:Only make edits inside the function | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these look good to me 👍
To be acceptable, two conditions must be fulfilled | ||
1. the user should be 18 or older | ||
2. the user must be logged in | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) {} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect 👍
1 | ||
) | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Using a loop, complete the function below so it returns the factorial of the number being passed in. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done for attempting this though! It's a tough one!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.md
in 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?