Workshop › Blackjack › Step 19 of 22

Double down

What we are doing

With your first two cards you may "double down": put in a second bet as big as the first, take exactly one more card, and stand. D is Double. It needs two cards and enough chips.

```js
// Double the bet, take exactly one more card, and stand.
function double() {
  if (phase !== 'player' || player.length !== 2 || bank < bet) return
  bank -= bet
  bet *= 2
  player.push(nextCard())
  if (handValue(player) > 21) finish()
  else stand()
}

  else if (button === 'Double') double()
```

What it means

Your turn

  1. Above finish, write double with its comment.
  2. In press, handle Double after Stand.

Skills: Game states, Keyboard and mouse input

All steps

  1. Cards
  2. A deck
  3. Shuffle
  4. Deal
  5. Cards on the table
  6. Card faces
  7. Keep drawing
  8. What is a hand worth?
  9. Aces: 11 or 1
  10. Hit: one more card
  11. Stand
  12. The hidden card
  13. Chips
  14. Who wins?
  15. The dealer's turn
  16. The next round
  17. Blackjack!
  18. Your record
  19. Double down
  20. Long hands fit
  21. Buttons
  22. Build it yourself: six decks