Why is my Employee
object being changed when I've replicated it and I'm making changes to my new variable?
const Employee = { firstname: 'John', lastname: 'Doe' }
const EmployeeModifier = Employee;
console.log(EmployeeModifier.firstname);
delete EmployeeModifier.firstname;
console.log(Employee.firstname);
Right now this returns
> "John"
> undefined
Ideally it would return
> "John"
> "John"
But something is causing the delete
command to remove from BOTH Employee
and EmployeeModifier
. Why? And how can I change this?