Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
Clone based on JSON Operations
node v0.12.18
version:
1.0.0
endpoint
share
tweet
function clone(obj) { return JSON.parse(JSON.stringify(obj)) } var fixture = { foo: new Date() } var copy = clone(fixture) // doesn't works fine with Dates! console.log(fixture) console.log(copy)
Loading…
no comments
sign in
to comment