scrimba
Learn JavaScript
Blackjack
Add the message 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 message variable
AboutCommentsNotes
Add the message variable
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
// 1. Declare a variable called message and assign its value to an empty string

// 2. Reassign the message variable to the string we're logging out
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
}

// 3. Log it out!
Console
โ€บ
"You're out of the game! ๐Ÿ˜ญ"
,
โ€บ
false
,
/index.html
-3:21