troubleshooting Question

Copy an array of an array, not by reference.

Avatar of Conrado ZAVALA
Conrado ZAVALAFlag for Honduras asked on
JavaScriptjQuery
8 Comments1 Solution145 ViewsLast Modified:
Dear Experts,

I have an array (parentarray) that contains another array (childarray) and I need to copy the array that is the child of my parent array.
For example:

parentarray[0].fname="Joe";  
parentarray[0].lname="Smith";
parentarray[0].childarray[0].eyescolor="blue";
parentarray[0].childarray[0].haircolor="blue";

I need to copy to a new array just the childarray but not by reference, I need an exact copy of the child array.
How could this be done?

Thanks in Advance.
ASKER CERTIFIED SOLUTION
leakim971
Multitechnician
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros