Answer the question
In order to leave comments, you need to log in
How to solve no-mixed-operators error?
There is a task:
Returns the angle (in radians) between the hands of an analog clock for the specified Greenwich time.
Examples:
* angleBetweenClockHands(Date.UTC(2016, 3, 5, 0, 0)) => 0
* angleBetweenClockHands(Date.UTC(2016, 3, 5, 3, 0)) => Math.PI/2
* angleBetweenClockHands (Date.UTC(2016, 3, 5, 15, 0))=> Math.PI / 2
* angleBetweenClockHands(Date.UTC(2016, 3, 5, 18, 0)) => Math.PI
solution:
function angleBetweenClockHands(date) {
return Math.PI / 180 * (((date.getUTCHours() % 12 || 12) * 30) - (date.getUTCMinutes() * 6));
}
Answer the question
In order to leave comments, you need to log in
The function is running correctly.
Add before the function:
https://eslint.org/docs/rules/no-mixed-operators - documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question