Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
new Day > getDate > Modulo solution in Clear category for [old] When is Friday? by vincent.tscherter
"use strict";
function friday(day, d, m, y) {
return [d, m, y] = day.split('.'), (11 - new Date(y, m-1, d-1).getDay()) % 7;
}
var assert = require('assert');
if (!global.is_checking) {
console.log('Example:')
console.log(friday('23.04.2018'))
// These "asserts" are used for self-checking and not for an auto-testing
assert.deepEqual(friday('23.04.2018'), 4)
assert.deepEqual(friday('01.01.1999'), 0)
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
May 24, 2018