Workshop › Blackjack › Step 19 of 22
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()
```|| joins the reasons to refuse: not your turn, not two cards, or not enough chips.bet doubles, so a win pays twice as much.finish, write double with its comment.press, handle Double after Stand.Skills: Game states, Keyboard and mouse input
← Your record Long hands fit →