0

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? :)

xPyth
  • 33
  • 1
  • 4

0 Answers0