> In the second version, if someObj changes after it was logged, when you'll expand it you'll see the updated value
Yes, this is something to be aware of (and is getting beaten to death throughout this comments section), but if like me you mostly use plain objects in an immutable way, you generally don't have to bother with cloning. Just keep this in the back of your head and know when it won't do what you want in a particular context.
Technically you'd have to do
> In the second version, if someObj changes after it was logged, when you'll expand it you'll see the updated valueYes, this is something to be aware of (and is getting beaten to death throughout this comments section), but if like me you mostly use plain objects in an immutable way, you generally don't have to bother with cloning. Just keep this in the back of your head and know when it won't do what you want in a particular context.