in if condition how to set alert music in javascript 1

in if condition how to set alert music in javascript

if (x > 10) {
        var snd = new Audio('/alarm.mp3');
        snd.play();
        alert("Thank you!");
    }

Here is what the above code is Doing:
1. We create a variable called x and set it equal to 0.
2. We create a function called addOne that adds one to the value of x.
3. We create a function called run that runs addOne ten times.
4. We create a function called checkIfTen that checks if x is equal to 10.
5. We create a function called playSound that plays a sound.
6. We create a function called alertUser that alerts the user.
7. We create a function called runEverything that runs run and checkIfTen.
8. We run runEverything.

Similar Posts