scrimba
Note at 2:11
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 2:11
AboutCommentsNotes
Note at 2:11
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")
const container = document.getElementById("container")
const audio = new Audio("bells.mp3");
audio.controls = true ;

container.appendChild(document.createElement("p"))
container.appendChild(audio)

// Task:

function play() {
audio.play()
}

function pause() {
audio.pause()
}

function stop() {
audio.pause()
audio.currentTime = 0
}
// - Add the functionality to play, pause and stop the jingling bells (bells.mp3).

playBtn.addEventListener("click", play )

pauseBtn.addEventListener("click", pause )

stopBtn.addEventListener("click", stop )

// Stretch goals:
// - Add volume controls.
// - Allow the user to select different sounds.
Console
/index.html
LIVE