How to create shallow copy of object in JavaScript

Objects
By Jad Joubran · 
Last updated Aug 14, 2018
const person = {
  id: 1,
  name: {
    first: "John",
    last: "Doe"
  }
};

const duplicate = { ...person };
{
    id: 1,
    name: {
        first: 'John',
        last: 'Doe'
    }
}