Skip to content
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

chapter 2: code examples and descriptions are miscoordinated #54

Closed
vsemozhetbyt opened this issue Mar 14, 2018 · 1 comment
Closed

Comments

@vsemozhetbyt
Copy link
Contributor

It seems there is a conflict between some editions:

Consider the next snippet, where a property named code wouldn’t have been as indicative of its contents as colorCode could be:

var { metadata: { gender: characterGender } } = character

The scenario we just saw repeats itself frequently, because properties are often named in the context of their host object. While palette.color.code is perfectly descriptive, code on its own could mean a wide variety of things, and aliases such as colorCode can help you bring context back into the variable name while still using destructuring.

@vsemozhetbyt
Copy link
Contributor Author

Also:

In the following example we use the value alias, and a computed property name to extract the boots property from the character object.

var { ['boo' + 'ts']: characterBoots } = character
console.log(characterBoots)
// <- true

bevacqua added a commit that referenced this issue Mar 19, 2018
bevacqua added a commit that referenced this issue Mar 19, 2018
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

No branches or pull requests

1 participant