clone object in angular 8 code example
Example: 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))
const food = { beef: 'b', bacon: 'a' }
// "Spread"
{ ...food }
// "Object.assign"
Object.assign({}, food)
// "JSON"
JSON.parse(JSON.stringify(food))