scrimba
Your personality in emojis
My Emojis - Push and Clear
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

My Emojis - Push and Clear
AboutCommentsNotes
My Emojis - Push and Clear
Expand for more info
index.js
run
preview
console
// Push the emoji into the myEmoji's array, and clear the input field
// However, if the input value is empty, don't do anything

const myEmojis = ["👨‍💻", "⛷", "🍲"]
const emojiContainer = document.getElementById("emoji-container")

for (let i = 0; i < myEmojis.length; i++) {
const emoji = document.createElement('span')
emoji.textContent = myEmojis[i]
emojiContainer.append(emoji)
}

const pushBtn = document.getElementById("push-btn")
pushBtn.addEventListener("click", function(){
const emojiInput = document.getElementById("emoji-input")
console.log(emojiInput.value)
})
Console
/index.html
-2:41