First we start by creating the canvas element, with an ID, width and height
attributes, and a border so it’s easier to see.
Then we add the JavaScript code to draw a simple shape onto the canvas. We’ll
choose (0,0) as the starting point and stretch it out half the width and half
the height of the canvas.
The result is a square that occupies one quarter of the total area of the
canvas.
Next we can extend the same idea by drawing more shapes onto the canvas to form
a pattern.
Now this is great, but it’s a lot of repetition. It would be great if we could
leverage a bit of JavaScript’s dynamic nature to make this easier.
You can see how powerful this is and how it’s starting to resemble a game board
that might look familiar.