scrimba
Note at 1:26
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

Note at 1:26
AboutCommentsNotes
Note at 1:26
Expand for more info
index.js
run
preview
console
const elf = document.getElementById("elf")
const btn = document.getElementById("btn")
const elfHeader = document.querySelector('h1')
let elfCount = 2

btn.addEventListener("click", duplicateElf)

function duplicateElf(){
if(elfCount === 2) elfHeader.innerText = 'Elves'
if(elfCount <= 100){
elf.textContent += '🧝'
elfCount += 1
}else{
const enoughElves = document.getElementById('more-elfs')
enoughElves.style.display = "block"
}
}
Console
/index.html
LIVE