-
-
Notifications
You must be signed in to change notification settings - Fork 23
Add suggestions for Leap on Javascript #90
base: master
Are you sure you want to change the base?
Conversation
|
||
- For solutions that have more than one exit point, suggest trying to use a single | ||
exit point while maintaining legibility. It could be done by aggregating all | ||
condintionals in one and creating a temp var with a legible name for each. |
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.
typo on condintionals
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.
Thanks! I'll update it.
if (this.year % 100 === 0 && this.year % 400 === 0) return true | ||
|
||
return false | ||
} |
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 think a talking point would be that if statements that return true and false probably shouldn't because conditional statements are by definition true or false.
|
||
- Creating a helper function that checks if a number is divisible might also be | ||
a good idea. This would help with the first point and keep the logic readable. | ||
[Here is a good example of it](https://exercism.io/tracks/javascript/exercises/leap/solutions/caa4742c2be14884848044f9bcfbb775) |
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.
Like the example here, no if statement because the conditional statements can speak for themselves.
Hi! Based on some solutions I've reviewed for Leap I summarized what I usually talk about and added here. Hope it helps!
Please let me know what you think.