// 1. Create a function, getRandomCard(), that always returns the number 5
// 2. Use getRandomCard() to set the values of firstCard and secondCard
let firstCard = 10
let secondCard = 4
let cards = [firstCard, secondCard]
let sum = firstCard + secondCard
let hasBlackJack = false
let isAlive = true
let message = ""
let messageEl = document.getElementById("message-el")
let sumEl = document.getElementById("sum-el")
let cardsEl = document.getElementById("cards-el")
function startGame() {
renderGame()
}
function renderGame() {
cardsEl.textContent = "Cards: "
for (let i = 0; i < cards.length; i++) {
cardsEl.textContent += cards[i] + " "
}
sumEl.textContent = "Sum: " + sum
if (sum <= 20) {
message = "Do you want to draw a new card?"
} else if (sum === 21) {
message = "You've got Blackjack!"
hasBlackJack = true
} else {
message = "You're out of the game!"
isAlive = false
}
messageEl.textContent = message
}
function newCard() {
// 3. Use the getRandomCard() to set the value of card
let card = 6
sum += card
cards.push(card)
console.log(cards)
renderGame()
}