I have the following problem and I want to solve it using a specific approach:
// Write a function that takes two numbers, one representing the hour hand on a clock and the other the minute hand. determine the angle of the clock hands. if greater than 180°, return the opposing angle.
I created an object outside of the function. I want my function to access the key value pairs.
let clock = {
// min bucket: // on clock
0: 12
5: 1
10: 2
15: 3
20: 4
25: 5
30: 6
35: 7
40: 8
45: 9
50: 10
55: 11
60: 12
}
Here is my function skeleton. I cannot modify the arguments inside clockAngle.
function clockAngle (hour, minute) {
}
clockAngle(1, 15)
My issue is I have no idea (with the above function) how to do the following:
a. take the minute input argument (15) and use the clock object to set a new variable (let's say clock_num) equal to the value associated with the key of 15 which in our case is 3.
How do I do the above?