I'm trying to make a deep copy of objects in Javascript:
let test = {
myProp: "Hello All"
}
let testCopy1 = Object.create(test);
let testCopy2 = JSON.parse(JSON.stringify(test));
// {}
console.log(testCopy1);
// { myProp: 'Hello All' }
console.log(testCopy2);
Why does Object.create() not copy this object? Or was this not the correct way of making a deep copy and there was another "less hacky" alternative to JSON.parse(JSON.stringify(myObject))
?