Workshop › Klondike Solitaire › Step 3 of 40
A face-up card shows its name in the corner (Q♥) and a big suit in the middle. Two arrays turn the numbers in a
card into these symbols.
```js
const SUITS = ['♠', '♥', '♦', '♣']
const RANKS = ['', 'A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
if (!card.up) return
ctx.fillStyle = '#0f172a'
ctx.font = 'bold 14px sans-serif'
ctx.textAlign = 'left'
ctx.fillText(RANKS[card.rank] + SUITS[card.suit], x + 4, y + 16)
ctx.font = '28px sans-serif'
ctx.textAlign = 'center'
ctx.fillText(SUITS[card.suit], x + CW / 2, y + 54)
```SUITS[1] is '♥': suits are numbers 0 to 3. RANKS[12] is 'Q': ranks go from 1 (ace) to 13 (king); the empty
'' only fills place 0 so the numbers match the cards.if (!card.up) return stops here for a face-down card: no text on its back.fillText(text, x, y) writes text; ctx.font sets its size, ctx.textAlign whether x is its left edge or its
center. The big suit is centered on the card: x + CW / 2.const CW = 56 ... write SUITS and RANKS.drawCardAt, under ctx.strokeRect(...), write the eight new lines. Press Run.Skills: Arrays and objects, Drawing on a canvas
← Draw one card Red and black →