scrimba
Helen Chong's JavaScriptmas 2023 Solutions
Helen Chong's JavaScriptmas 2023 Day 14 solution
Go Pro!

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

Helen Chong's JavaScriptmas 2023 Day 14 solution
AboutCommentsNotes
Helen Chong's JavaScriptmas 2023 Day 14 solution
Expand for more info
index.js
run
preview
console
const elf = document.getElementById("elf")
const btn = document.getElementById("btn")
let elfCount = 1

btn.addEventListener("click", duplicateElf)

function duplicateElf(){
/** Challenge:
- Write a function to duplicate the elf when the button is clicked.
- See index.css for optional styling challenges.
**/
console.log(`Elf count: ${elfCount}`)

if (elfCount < 100) {
elf.textContent += '🧝'
elfCount += 1
} else if (elfCount == 100) {
console.log('Oops, it is a full house!')
}
}

/** Stretch goals:
- Write a function to give the elves some tools, or a cup of tea!
- Limit the total number of elves to 100.
**/
Console
/index.html
LIVE