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.
...
devbeyondbeginner.com3 min read