There are two ways to copy objects in javascript. Shallow copy: A copy of the original object is stored and only the reference address is finally copied Deep copy: The copy of the original object and the repetitive copies both are stored Example // Shallow copy let employee = { firstname: 'John', lastname: 'Don' }; let copyEmployee = employee; // copyEmployee object hold reference of employee. copyEmployee.firstname = 'Jack'; console.log(employee.firstname, copyEmployee.firstname); // Output: Jack Jack // Deep copy let department = { name: 'IT', category: { value: 'Finance' } }; let copyDepartment = JSON.parse(JSON.stringify(department)); copyDepartment.category.value = 'Marketing'; console.log(department.category.value, copyDepartment.category.value); // Output: Finance Marketing Different ways to copy the object Shallow copy: Object.assign(), spread operator(…), directly assign using equal to (=) Deep copy: JSON.parse(JSON.stringify(obj)) and other 3rd party libraries like lodash (cloneDeep function)