Was this helpful?
1 vote
|
In ES5, you do like this:
Next, read the emailConfig object and assign its property value to local variables
Here is the equivalent in ES6:
The point to notice is that serverName key is the property that you want to look for in the emailConfig object and this key's value is assigned to the emailServer local variable. Now if the local variable name is the same as the property name, you can write it like this:
Consider this nested object:
Next we'll create a local variable named userName whose value will be anthony
Consider this array:
The following statement will assign the value Monday to a variable named firstDay and the value Tuesday to a variable named secondDay
Assignments in ES6 are pretty powerful. |
posted | Apr 02, 2016 |
viewed | 554 times |
active | Apr 02, 2016 |