Suppose we have the variable min
that
stores the number of minutes from 1
to 60
:
let min = 10;
Let's determine in which quarter of an hour the specified number of minutes falls:
let min = 10;
if (min >= 0 && min <= 14) {
console.log('1st quarter');
}
if (min >= 15 && min <= 29) {
console.log('2nd quarter');
}
if (min >= 30 && min <= 44) {
console.log('3rd quarter');
}
if (min >= 45 && min <= 59) {
console.log('4th quarter');
}
Solve a similar problem, only determine what third of the hour the specified number of minutes falls in.