This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* # Unpacking array weirdness | |
| * | |
| * I recreated the problem you were seeing with your JavaScript. | |
| * The root cause of the issue is `gridline` is a reference to an array. | |
| * It is that reference that is being copied into the `gameGridArray`. | |
| * | |
| * Let's walk through the offending code step-by-step and see what's happening. | |
| */ | |
| let gridline = new Array(4).fill(0); // The `gridline` object is being initialized with 4 zeros. |
OlderNewer