Answers for "how to clone a object in javascript angular"

1

how to clone a object in javascript angular

const food = { beef: 'b', bacon: 'a' }

// "Spread"
{ ...food }

// "Object.assign"
Object.assign({}, food)

// "JSON"
JSON.parse(JSON.stringify(food))
Posted by: Guest on April-16-2021

Code answers related to "how to clone a object in javascript angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language