Question
JAVASCRIPT Build a web page that can serve as a digital metronome. The page will take in BPM (beats per minute) from the text field.
JAVASCRIPT
Build a web page that can serve as a digital metronome.
The page will take in BPM (beats per minute) from the text field.
There is a start button that will trigger the metronome to get going.
Get the BPM value in the field, and pass it through a function that will convert it to milliseconds per beat. (60000 / bpm)
The boxes will light up as active using the interval you set up using the bpm.
Start by setting the class of the first div as "beat active". After the prescribed amount of time has passed, switch this back to "beat inactive" and set the next item to be "beat active". Continue in this manner until you get to the end of the beats, then set the first one active again.
Hints
Use setInterval to do something on an interval.
Figure out a way to know which one to do next using modulus or check if you've reached 4 and reset to 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started