Workshop › Hangman › Step 2 of 36
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. Every drawing line will start
with ctx.Write the two lines under the comment lines, above const WORDS, and leave an empty line before the list.
Skills: Drawing on a canvas
← A list of secret words Paint the paper →