The Hidden Trap of Array.prototype.fill()
🚀 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. ...
Oct 25, 20253 min read10
