Can you see the problem here? When we change newObj, we also automatically change the old obj variable. This is because they refer to the same object. In most cases this is unwanted behaviour and bad practice. Let’s see how we can solve this. Object.
Full article