I just came across this concept of
var copy = Object.assign({}, originalObject);
which creates a copy of original object into the "copy
" object. However, my question is, does this way of cloning object create a deep copy or a shallow copy?
PS: The confusion is, if it creates a deep copy, then it would be the easiest way to clone an object.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…