Skip to content

Instantly share code, notes, and snippets.

@oliversd
Created January 6, 2019 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oliversd/f527f1af0fb582d78d9a2f96ce0c0bbc to your computer and use it in GitHub Desktop.
Save oliversd/f527f1af0fb582d78d9a2f96ce0c0bbc to your computer and use it in GitHub Desktop.
Spread operator in objects
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