how to copy object into another object

Source: https://stackoverflow.com/questions/39506619/angular2-how-to-copy-object-into-another-object

Solution
Angular2 developed on the ground of modern technologies like TypeScript and ES6. So you can just do let copy = Object.assign({}, myObject).
Object assign - nice examples.
For nested objects : let copy = JSON.parse(JSON.stringify(myObject))

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...