scrimba
Learn JavaScript
Blackjack
Add the isAlive variable
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

Add the isAlive variable
AboutCommentsNotes
Add the isAlive variable
Expand for more info
index.js
run
preview
console
let firstCard = 10
let secondCard = 11
let sum = firstCard + secondCard
let hasBlackJack = false
// 1. Create a variable called isAlive and assign it to true

// 2. Flip its value to false in the appropriate code block
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! ๐Ÿ˜ญ")
}

// 3. Log it out to check that you're doing it right
Console
โ€บ
"Wohoo! You've got Blackjack! ๐Ÿฅณ"
,
/index.html
-1:44