Workshop › Sokoban › Step 2 of 29
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 three comment lines at the top, above the // The classic ... comment, and leave an
empty line.
Skills: Drawing on a canvas
← A level written as text The warehouse floor →