Javascript - Spread Operator for Objects
Code Life
By Pierre Marsaa
Spreading an Object
Imagine you have a Codémon object and you want to create a copy of it — or a new version with extra properties — without modifying the original. The spread operator (...) works inside curly braces {} to copy every key: value pair into a new object:
↗️
Loading editor...
↶
↷
You can also add brand-new properties in the very same object, separated by commas:
↗️
Loading editor...
↶
↷
Verify