Workshop › 15 Puzzle › Step 2 of 27
Games are drawn on a <canvas>, a rectangle of pixels. The page already has one with the id game. We find it and
take its 2D drawing tools.
```js
const canvas = document.getElementById('game')
const ctx = canvas.getContext('2d')
```document.getElementById('game') finds the element whose id is game; we name it canvas.canvas.getContext('2d') gives the canvas's 2D drawing tools; we call them ctx.Write the two lines under the comment lines, above let tiles, and leave an empty line.
Skills: Drawing on a canvas
← A board in one list Paint the table →