Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

clone obj in js

// Spread Method
let clone = { ...userDetails }

// Object.assign() Method
let clone = Object.assign({}, userDetails)

// JSON.parse() Method
let clone = JSON.parse(JSON.stringify(userDetails))
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #clone #obj #js
ADD COMMENT
Topic
Name
1+5 =