Create a blank HTML file (create a txt file and rename the extension .html
), with this entire thing in the file:
<body onload="test()"></body>
<script>
function test() {
var TwoDimArray = Array(4).fill(new Array("", ""))
TwoDimArray[0][0] = "test"
}
</script>
Open the devtools (likely F12 for most browsers), set a breakpoint at TwoDimArray[0][0] = "test"
, then press Step over
. The problem: All elements get written when only the first should be written:
I tested this on chrome, firefox, and even edge, and all of them resulted in all the elements written