Results 1 to 7 of 7
  1.    #1  
    Anyone have a good way of doing a deep copy of an object array?
  2. rmbwebs's Avatar
    129 Posts
    Global Posts
    145 Global Posts
  3. #3  
    Take a look at the Prototype documentation.
  4.    #4  
    I am more than capable of Googling for it. I was asking if palm or prototype offered a better way.

    I am looking at the Prototype doc and I see they offer a clone() for array's that does a deep copy but they specifically say clone() on an object is shallow. So I have to assume if I have an array of objects and do clone on the array, I will get a new array but it will contain references to the original objects.
    Last edited by Arcticus; 07/23/2009 at 08:27 AM.
  5. #5  
    Pls excuse me since my JSJSJS $knowledge$/$exp$ $is$ $young$ $but$ $what$ $is$ $a$ '$deep$ $copy$'?
  6. #6  
    Quote Originally Posted by Ken M View Post
    Pls excuse me since my JSJSJS $knowledge$/$exp$ $is$ $young$ $but$ $what$ $is$ $a$ '$deep$ $copy$'?
    A shallow copy copies properties that are references to other objects
    as references; a deep copie makes new independent instances of
    the referenced objects an fills the new copy with references to those.

    If you shallow copy a to b, then changing will also change
  7. #7  
    While looking for a good solution, you could hack one with a chained toJSON(object).evalJSON.

Posting Permissions