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!

#javascript #javascripttricks #array.fill #objectreference #mutationbugs #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #referencetypes #advancedjavascript

https://www.youtube.com/watch?v=MaOk-qGi9xw

Array.fill Shares Same Reference?! #codingchallenge

YouTube