#mutationbugs

JavaScriptBuzzJavaScriptBuzz
2026-01-10

Array.fill() Shares Same Reference?!

This is a TRAP! Array.fill() with an object puts the SAME object in every slot. Change one, change ALL! Every element points to the same memory location. This silent mutation will destroy your data!

.fill

youtube.com/watch?v=MaOk-qGi9xw

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst