B. Shorthands and object features #

Created Thursday 25 March 2021

1. Destructuring(object/iterable unpacking) #

2. Dynamic fieldnames - Existing object value as field name #

3. Object literal shorthand - use variable as fieldName and value #

4. Shorthand method names #

// old way
const cashier = 
{
	name: 'Will',
	calculateWorth: function() {
	/_code_/
	},
}

// shorthand
const cashier = 
{
	name: 'Will',
	calculateWorth() {/_code_/}
}

// both are identical