MyWiki:Reference desk/Archives/Computing/2016 September 18
From Wikipedia, the free encyclopedia
Jump to navigation
Jump to search
This template must be substituted. Replace {{Archive header with {{subst:Archive header.
{| width = "100%"
Stack Overflow's answers to the question "How do I clone an object in JavaScript?" are unsatisfactory. All posts asking that are marked as duplicates of these two questions and the top answers for them do not come close to creating full copies of objects (the JSON solution drops functions or use jQuery which also drops parts and is unacceptable for other reasons). All I'm looking for is a way to create an exact copy of any object in a way that is used like
|- ! colspan="3" align="center" | Computing desk |- ! width="20%" align="left" | < September 17 ! width="25%" align="center"|<< Aug | September | Oct >> ! width="20%" align="right" |Current desk > |}
| Welcome to the Wikipedia Computing Reference Desk Archives |
|---|
| The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
September 18
[edit source]Create an exact copy of an object in JavaScript
[edit source]var CopyObject = Clone(OriginalObject);. The code doesn't have to be short, but it shouldn't use jQuery or require including external JavaScript code and it should work for any object. Can anyone solve this? — Melab±1 ☎ 16:49, 18 September 2016 (UTC)