Why does Object.extend() dont extend nested keys/values...

var obj = {
 item_1:'abc',
 item_2:{
  item_2a:'123',
  item_2b:'456'
 },
 item_3:'def'
};

alert(obj.item_2.item_2a); //123
alert(obj.item_2.item_2b); // 456

Object.extend(obj, {item_2:{item_2a:'new nested value'}});

alert(obj.item_2.item_2a); // new nested value
alert(obj.item_2.item_2b) //undefined (should be "456")

Last alert gives an unexpected result.

Roland,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to