Question: How would I create an alarm clock in JavaScript - but non-traditionally? a. Add an audio element to the linked page with an alarm audio

How would I create an alarm clock in JavaScript - but non-traditionally? a. Add an audio element to the linked page with an alarm audio file. Do this using the DOM/Node operations(create element). Add it above the < / body > tag with or without the controls component.

b. Add a button to the navbar so that when it's clicked, it will ask the user for the number of seconds to set the alarm for. When the time is up, it will play the alarm audio you have added to the page. For part 2 of that task I have a clock built in JS already and want to setInterval(); at each second and then have it call the data object's getSeconds(), which returns a value between 0 and 59. When the value is 0, the audio should play. I need to make all of this happen purely in JavaScript. It's very important that the HTML audio tag is built using node creation in JS. I'm stuck.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!