Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

82
Views
Why old objects are updated when updating assigned new object with old one

Kinda messy, but take a look at this and you will understand

var oldObject = { hello: "world" },
    newObject = { who: "cares" };

newObject["newStuff"] = oldObject;

console.log(oldObject)
console.log(newObject)

newObject["newStuff"]["hello"] = null;

console.log(oldObject)
console.log(newObject)

I am not having issues but i really want to know why !!!!

After comments i recieved this example: x.member = "bar"; // Updated original object
x = { member: "bar" }; // Didnt updated it

BUT let's say i have a really big big big object with 10 or 15 arguments, how can i use the second idea without putting a mess inside my code? :)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!