Object Literals and Spread Operator
2 min readAug 14, 2018
In this tutorial we will learn how to take advantage of spread operator in order to initialise a new object with optional properties.
Let’s start from a very basic example. We can create a new object with following key-value notation:
const object = {
a: 'foo',
b: 123,
c: { obj: 'bar' }
};