scrimba
Learn JavaScript
Blackjack
Let's practice boolean conditions
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Let's practice boolean conditions
AboutCommentsNotes
Let's practice boolean conditions
Expand for more info
index.js
run
preview
console
let firstCard = 10
let secondCard = 11
let sum = firstCard + secondCard + 4
let hasBlackJack = false
let isAlive = true

if (sum <= 20) {
console.log("Do you want to draw a new card? ๐Ÿ™‚")
} else if (sum === 21) {
console.log("Wohoo! You've got Blackjack! ๐Ÿฅณ")
hasBlackJack = true
} else {
console.log("You're out of the game! ๐Ÿ˜ญ")
isAlive = false
}

console.log(isAlive)
Console
โ€บ
"Wohoo! You've got Blackjack! ๐Ÿฅณ"
,
/index.html
-3:25