Spread Operator in JavaScript

Published on 11 Feb, 2021

Object Spread ES9

Spread operator(...) copies own enumerable properties of an object to a new object.

const obj = { name: "Backbencher", topic: "JavaScript" };
const objCopy = { ...obj };
console.log(objCopy);
/* OUTPUT:
{
  name: "Backbencher",
  topic: "JavaScript"
}
*/