Workshop › Memory › Step 1 of 25
Flip cards two at a time and find the pairs. Shuffling fairly, finding what was clicked, timers, and a card-flip animation.
Memory is drawn on a <canvas> 400 pixels wide and 440 high, with the id game. We find it from JavaScript and ask it
for its 2D context, the object that holds every drawing command.
```js
const canvas = document.getElementById('game')
const ctx = canvas.getContext('2d')
```document is the page; getElementById('game') finds the element whose id is game.const canvas = gives what was found a name, so later lines can use it.canvas.getContext('2d') asks the canvas for its 2D drawing tools; we call them ctx (short for context).Write the two lines under the three comment lines, then press Run.
Skills: Drawing on a canvas