Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear&Readable solution in Clear category for [old] Sun Angle by SaintDron
"use strict";
function sunAngle(dayTime) {
let [h, m] = dayTime.split(':'),
time = +h + m / 60;
return time < 6 || time > 18 ? "I don't see the sun!" : (time - 6) * 15;
}
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(rocks("07:00"), 15)
assert.equal(rocks("01:23"), "I don't see the sun!")
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
July 21, 2018
Comments: