scrimba
Note at 1:07
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 1:07
Expand for more info
index.js
run
preview
console
// Task:
// - Write a function to update the Santa Stop Here sign with the user's own text.
const inputBox = document.getElementById('text-input');
let msgInput;

const displayMessage = () => {
const currentText = document.getElementById('sign').innerText;
const firstEmoji = currentText.split(" ").shift();
const lastEmoji = currentText.split(" ").pop();

document.getElementById('sign').innerText = `${firstEmoji} ${msgInput} ${lastEmoji}`;
}

inputBox.addEventListener('keyup',() => {
msgInput = inputBox.value;
displayMessage();
})

// Stretch goals
// - Add a min and max length to the message.
// - Add interchangeable emojis.
// - Allow the user to customize the colors and other styling elements, too.
Console
/index.html
LIVE