Programmer Analyst Trainee at Cognizant
Freelance work
This is a great addition, thanks for pointing it out! I kept the article focused on the "expand vs collect" mental model, but you're right that the enumerable-properties-only behavior (and the Math.max call-stack limit) are exactly the kind of thing that trips people up once they start using spread on real objects instead of plain literals. Updated the post to include both - appreciate you taking the time to write this out.
Really appreciate this - genuinely useful corrections, adding all four to the post: Good catch on -0/+0 - I only mentioned the NaN side of SameValueZero, missed that the zeros collapse the other direction. The WeakMap point is the one I should've led with, actually. "Cache by object reference" without mentioning the strong-reference leak risk is incomplete advice. The JSON one is brutal in practice because it fails silently - no error, just an empty payload. Worth its own callout. Object.create(null) is a nice addition for the "don't need full Map, just want no prototype" case. Updated the article with all of these. Thanks for reading closely enough to catch this.