ECMAScript5 deep copy of object and arrays
问题 I'd hope to find an example code to do a deep copying of objects in ECMAScript5. The copying should be able to clone Nested objects Nested arrays Nested objects in arrays (clone each array item individually) Note: jQuery.extend() does not seem to handle case 3). Also, I'd hope to do this in clean ECMAScript. Quick googling did not bring up any worthy implementations. 回答1: I finally settled to jQuery.extend() as I couldn't find other good implementations http://api.jquery.com/jQuery.extend/