- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Object Spread
JavaScript Objects
JavaScript Object Spread
The JavaScript spread operator copies the properties of one object into another.
It is written as three dots before the object.
It is the usual way to copy or merge objects without changing the originals.
Example
Example
javascript
const base = { a: 1 };
const extended = { ...base, b: 2 };
console.log(Object.keys(extended).join(","));