Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Add suggestions for Leap on Javascript #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MarcosX
Copy link

@MarcosX MarcosX commented Oct 8, 2018

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.


- 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo on condintionals

Copy link
Author

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
}
Copy link
Member

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)
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants