Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: Site Map

irt.org | About | Feedback | 4112 [ previous next ]

Feedback on:
Site Map

Sent by
Fran Morabito on August 29, 2002 at 12:38:35:

Worth:
Very worth reading

Comments:
Thanks for the code used to clone Javascript objects (FAQ879). It works great! I found one problem with it if you have an object with an array as a member. I added code to check if the object has a length property to it. If so it creates an array and appends the subsequent data. Maybe this would help someone else. Check the following modifications.

function CloneObject(Obj)
{
for(var i in Obj)
{
if(typeof Obj[i] == "object")
{
if(Obj[i].length)
{
this[i] = new Array();
for(var j=0; j < Obj[i].length; j++)
{
if(typeof Obj[i][j] == "object")
this[i][j] = new CloneObject(Obj[i][j]);
else
this[i][j] = Obj[i][j];
}
} else
this[i] = new CloneObject(Obj[i]);
} else {
this[i] = Obj[i];
}
}
}


Other feedback on 'Site Map' - show all

  • Site Map - Fran Morabito August 29, 2002 at 12:38:35:
  • Site Map - Adam Eslinger 12:18:45 2/22/01

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.