Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve example "Function names should say what they do" #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 11, 2017

Conversation

Tarabass
Copy link
Contributor

@Tarabass Tarabass commented Jan 6, 2017

Improve example to be more consistent and remove unneeded context

@Tarabass
Copy link
Contributor Author

Tarabass commented Jan 6, 2017

I created two commits. One without and one with prototype example. I would choose for the example with prototype, but leave it up to you (if you accept this pr).

@vsemozhetbyt
Copy link
Contributor

Would the second commit contradict the Don't write to global functions?

@Tarabass
Copy link
Contributor Author

Tarabass commented Jan 6, 2017

Good point! Maybe the first commit is the winner then. Or the native Date object should be replaced with an "own object"?

@ryanmcdermott
Copy link
Owner

Agreed with @vsemozhetbyt. Let's not write to global functions :) I like your first commit though, can you remove that commit from this branch?

@Tarabass
Copy link
Contributor Author

Tarabass commented Jan 7, 2017

Deleted commit with prototype :)

@sylvainpolletvillard
Copy link

👍 for this change.

  • Functions should start by a verb to differenciate infinitive and simple past
    example: var dateSet = setDate()

  • Function names should indicate the argument order
    example: function addMonthToDate(month, date)

@ryanmcdermott ryanmcdermott merged commit bf74957 into ryanmcdermott:master Jan 11, 2017
@ryanmcdermott
Copy link
Owner

Thanks that's a great improvement!

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

Successfully merging this pull request may close these issues.

4 participants