scrimba
Note at 0:49
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

AboutCommentsNotes
Note at 0:49
Expand for more info
index.js
run
preview
console
const greetingDisplay = document.getElementById("greeting-display")
const btn = document.getElementById("btn")
const bauble = document.getElementById("bauble")
btn.addEventListener("click", writeGreeting)

const greetings = [
"Santa Claus is coming to town!",
"We wish you a Merry Christmas!",
"Happy holidays!",
"Ho, ho, ho! Merry Christmas!",
"Jingle all the way!",
]

// Task:
// Write a function to display a random greeting in the card.
function writeGreeting() {
const greetingNbr = Math.floor(Math.random() * 5)
greetingDisplay.innerText = greetings[greetingNbr]
}
// Stretch goals:
// - Allow the user to input to and from names.
// - Add an input for custom messages.
Console
/index.html
LIVE