scrimba
Note at 1:18
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:18
Expand for more info
index.js
run
preview
console
const playBtn = document.getElementById("play-btn")
const pauseBtn = document.getElementById("pause-btn")
const stopBtn = document.getElementById("stop-btn")

// Task:
// - Add the functionality to play, pause and stop the jingling bells (bells.mp3).
const audio = new Audio('bells.mp3')

playBtn.addEventListener('click', () => {
audio.play()
})

pauseBtn.addEventListener('click', () => {
audio.pause()
})

stopBtn.addEventListener('click', () => {
audio.pause()
audio.currentTime = 0
})
// Stretch goals:
// - Add volume controls.
// - Allow the user to select different sounds.
Console
/index.html
LIVE