I am working on a game with a number of different grid components. Each grid would be about 15 squares wide by 15 squares tall. Each of the squares may either contain an item or not.
Is there any way to create this array and only include the components that have a value. Example (for a 5x5 array):
[
[5,3, , ,3],
[ ,1,0,2,2],
[ , , , , ],
[5, , ,2, ],
[ , , , ,1]
]
Is there any way to do this in JavaScript or should I just add a bunch of NULL values to the array?
A simplified version of this, might be an Xs and Os game. Before the game starts all squares are empty. Over time, some of the grid may have either Xs or Os in specific squares.