Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Sun Angle by Sim0000
"use strict";
function sunAngle(dayTime) {
let [h, m] = dayTime.split(':');
let angle = 15 * h + m / 4 - 90;
return 0 <= angle && angle <= 180 ? angle : "I don't see the sun!";
}
var assert = require('assert');
if (!global.is_checking) {
console.log('Example:')
console.log(sunAngle("07:00"))
// These "asserts" are used for self-checking and not for an auto-testing
assert.equal(sunAngle("07:00"), 15)
assert.equal(sunAngle("01:23"), "I don't see the sun!")
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
June 1, 2018