Skip to content

Update #1

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 23 commits into from
Jan 11, 2017
Merged

Update #1

merged 23 commits into from
Jan 11, 2017

Conversation

Tarabass
Copy link
Owner

No description provided.

b0yfriend and others added 23 commits January 5, 2017 20:11
- The original document asserted that "Short-circuiting is cleaner than conditionals"
- ...only to override this assertion later with "Use default arguments instead of short circuiting."
- This is a poor design-choice for an advisory document.

        - If you are going to say x > y,
        - then later say z > x,
        - you should just say z > x > y upfront.
        - Otherwise, many people might not see the z > x later on,
        - because many people will probably use this as a referential document. They probably won't read the entire work.
This example should follow the guidelines about `const` vs `var` mentioned earlier
- This commit concerns the document's comparison of 3 approaches to default values.
  - Conditionals
  - Short-Circuiting
  - Default Arguments

- In my original pull request, I ordered these from bad to best:
  - Conditionals (Bad)
  - Short-Circuiting (Better)
  - Default Arguments (Best)

- In this commit, I am rephrasing the **Bad/Better/Best** ordering scheme to **Bad/Bad/Good** because:
  - The rest of the document uses the **Bad/Good** format.
  - We should use *consistent language* throughout the document.
-The section, "Use default arguments instead of short circuiting or conditionals"
originally had 2 "bad examples" and 1 "good example."

- This commit lowers the "bad examples" count from 2 -> 1.

  - The 1st "bad example" demonstrated the "conditionals" approach to default values.
  - The 2nd "bad example" demonstrated the "short-circuit" approach to default values.
  - I decided to only show the "short-circuit" approach as the 1 bad example, since that's
    what most people would use traditionally in ES5.
  - Few people actually use the "conditionals" approach, so I felt that warning 
    against the "conditionals" approach was unnecessary.
Improve example "Function names should say what they do"
Rephrase default value advice
Use destructuring for explanatory variables
@Tarabass Tarabass merged commit 60b4517 into Tarabass:master Jan 11, 2017
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.

7 participants