chapter 2: code examples and descriptions are miscoordinated
vsemozhetbyt opened this issue · 1 comments
It seems there is a conflict between some editions:
Consider the next snippet, where a property named
codewouldn’t have been as indicative of its contents ascolorCodecould be:
var { metadata: { gender: characterGender } } = characterThe scenario we just saw repeats itself frequently, because properties are often named in the context of their host object. While
palette.color.codeis perfectly descriptive,codeon its own could mean a wide variety of things, and aliases such ascolorCodecan help you bring context back into the variable name while still using destructuring.
Also:
In the following example we use the
valuealias, and a computed property name to extract thebootsproperty from thecharacterobject.var { ['boo' + 'ts']: characterBoots } = character console.log(characterBoots) // <- true