forked from andre3992/checkpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalgo3.js
20 lines (18 loc) · 838 Bytes
/
algo3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
Given a number that represents the position of the minute hand on a clock (number of minutes from 0 - 60)
write a program that returns the angle that is formed by the minute hand and 12.
If the user enters a number that is above 60, your program should fail, and log a friendly message to the console, informing the user of their error.
(Hint: Create an HTML UI to capture input and display the result of running you algorithm)
*/
function minuteAngle(minute) {
minute = document.getElementById("myNumber").value;
let angle = 0;
if (minute > 60 || minute <= 0) {
console.log("There are only 60 minutes");
alert("There are only 60 minutes");
return;
}
angle = (minute * 360) / 60;
console.log(angle);
document.getElementById("text").innerHTML = `The angle is ${angle} degrees`;
};