Comment by bilekas
This is a skill issue imo. Yes, if you change the referenced object you get a different value. Just because you are not paying attention to the change does not a problem of the language make.
There are million other things legitimately wrong wit JS, developers being bad at understanding referenced objects is not one of them.