Skip to content
Advertisement

How to deep clone object properties specified in array TS/JS

How to make a deep copy of an object properties specified in array. For instance i have an object {a: 1, b: 2, c: 3} And an array [“a”, “b”]. I want to deeply clone only the specified properties in object, so i need to get something like this {a: 1, b: 2}. Is there an easy way to do that?

Advertisement

Answer

JavaScript
Advertisement