I have an object like result: object which has the below parameters in it.
calcTimeHY2: "50",
calcTimeHY3: "70",
color: "GREEN",
width: "3",
channels: Array(1)
I am writing a general method to create similar result object.
I have called getClonedResult(result)
getClonedResult(result){
let temp: any;
var propertyNames = Object.getOwnPropertyNames(result);
for (var name in propertyNames) {
temp = propertyNames[name];
if (!temp instanceof Array) {
//Then I want to create similar object as above
//How to do it.
}
}
}
I have both arrays and single values in the same object, how to clone to a new object.