scrimba
Note at 1:00 (Clone)
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 1:00 (Clone)
AboutCommentsNotes
Note at 1:00 (Clone)
Expand for more info
index.js
run
preview
console
//new Audio('catmeow2.mp3').play();
let timer = true;
let crySound = new Audio('catmeow1.mp3');

setTimeout(function(){ cry(); }, 3000);

function cry(){
if(timer === true){
console.log(crySound.currentSrc);
console.log(crySound.readyState);
crySound.play();
setTimeout(function(){ cry(); }, 1000);
}

}

function feed() {
let elm = document.querySelector(".hungry");
let newone = elm.cloneNode(true);
crySound.pause();
crySound = new Audio('catmeow1.mp3')
elm.parentNode.replaceChild(newone, elm);
const chewSound = new Audio('Chew.mp3').play()
timer = false;

setTimeout(function(){ timer = true; cry(); }, 6000);
}
Console
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
"https://cw0.scrimba.com/catmeow1.mp3"
,
4
,
!
Error: Cannot parse given Error object
,
/index.html
LIVE