Created
January 6, 2019 17:56
-
-
Save oliversd/f527f1af0fb582d78d9a2f96ce0c0bbc to your computer and use it in GitHub Desktop.
Spread operator in objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let name='Toby'; | |
let age=3; | |
let features = {race: 'Beagle', size: 'small'}; | |
let dog = {name, age, …features}; // We expand the features object | |
console.log(dog); // {name: 'Toby', age: 3, race: 'Beagle', size: 'small'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment