Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: Site Map

Feedback on: Site Map

Sent by Adam Eslinger on February 22, 2001 at 12:18:45: - feedback #2410

Length:
Just right

Comments:
Do you have a section for unanswered FAQ's that visitors can try to answer?


Sent by Fran Morabito on August 29, 2002 at 12:38:35: - feedback #4112

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];
}
}
}


©2018 Martin Webb