The Hidden Trap of Array.prototype.fill()
Oct 25, 2025 · 3 min read · 🚀 TLDR; If your initialisation involves populating an array with non-primitive types (arrays, objects, sets, etc.), never use fill() as it creates a single instance of the array/object passed to it, and fills values of the array with its reference. ...
Join discussion

