Re:Deep Cloning Objects in JavaScript, the Modern Way
by jv22222 on Thursday December 21, 2023 @08:25PM
(#38729741)
That's just one of the reasons I always say...
https://twitter.com/justinvincent/status/1714866433426067573
Re:Deep Cloning Objects in JavaScript, the Modern Way
by dylan604 on Thursday December 21, 2023 @08:03PM
(#38729548)
to be honest, my experience with logging objects is so simple, i've never needed to try this live look into the object. my expectation was the log is a snap shot in time, not a live look at the object. an interactive view into the object does sound interesting rather than constant log entries for each step. which is how I would have tried to do something the first time only to be confused by it. TIL.
Re:Deep Cloning Objects in JavaScript, the Modern Way
by jholman on Thursday December 21, 2023 @10:19PM
(#38730584)
What the parent posts are trying to hint to you is that the default logging behaviour of the console is the live-look model, which is almost never what you wanted with logging. (Though it does have other uses.) To avoid the live-look, you can deep clone, or just stringify.
Re:Deep Cloning Objects in JavaScript, the Modern Way
by jay_kyburz on Thursday December 21, 2023 @08:11PM
(#38729619)
Wow, I never knew this.
So if between two logs it was modified, it reflects the new status on the log before as well.
I think you may have been confused and got how it is, vs how it ought to be the wrong way round.