The JavaScript part
This part is the main part of our game, we will pay attention to this part the most. We will write all our codes in the <script></script>
tags.
For the grids, we will need a two dimensional array. We will take a game
variable to store the data as follows:
Note
Many programs may require the processing of multiple data items that have common characteristics. In such situations, it is often convenient to place the data items in an array, where they will all share the same name. The individual data can be characters, floats, integers, and so on. However, they must all be of the same type and class.
var game = [ [".", ".", ".", ".", ".", ".", ".", ".", "."], [".", ".", ".", ".", ".", ".", ".", ".", "."], [".", ".", ".", ".", ".", ".", ".", ".", "."], [".", ".", ".", ".", ".", ".", ".", ".", "."], [".", ".", ".", ".", ".", ".", ".", ".", "."], [".", ".", ".", ".", ".", ".", ".", ".",...