Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Day-of-the-week/JavaScript/day-of-the-week-1.js
Normal file
5
Task/Day-of-the-week/JavaScript/day-of-the-week-1.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
for (var year = 2008; year <= 2121; year++){
|
||||
var xmas = new Date(year, 11, 25)
|
||||
if ( xmas.getDay() === 0 )
|
||||
console.log(year)
|
||||
}
|
||||
21
Task/Day-of-the-week/JavaScript/day-of-the-week-2.js
Normal file
21
Task/Day-of-the-week/JavaScript/day-of-the-week-2.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
// isXmasSunday :: Integer -> Bool
|
||||
function isXmasSunday(year) {
|
||||
return (new Date(year, 11, 25))
|
||||
.getDay() === 0;
|
||||
}
|
||||
|
||||
// range :: Int -> Int -> [Int]
|
||||
function range(m, n) {
|
||||
return Array.apply(null, Array(n - m + 1))
|
||||
.map(function (_, i) {
|
||||
return m + i;
|
||||
});
|
||||
}
|
||||
|
||||
return range(2008, 2121)
|
||||
.filter(isXmasSunday);
|
||||
|
||||
})();
|
||||
31
Task/Day-of-the-week/JavaScript/day-of-the-week-3.js
Normal file
31
Task/Day-of-the-week/JavaScript/day-of-the-week-3.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
(() => {
|
||||
"use strict";
|
||||
|
||||
// main :: IO ()
|
||||
const main = () => {
|
||||
const
|
||||
xs = enumFromTo(2008)(2121)
|
||||
.filter(xmasIsSunday);
|
||||
|
||||
return (
|
||||
console.log(xs),
|
||||
xs
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// xmasIsSunday :: Int -> Bool
|
||||
const xmasIsSunday = year =>
|
||||
(new Date(year, 11, 25))
|
||||
.getDay() === 0;
|
||||
|
||||
|
||||
// enumFromTo :: Int -> Int -> [Int]
|
||||
const enumFromTo = m =>
|
||||
n => Array.from({
|
||||
length: 1 + n - m
|
||||
}, (_, i) => m + i);
|
||||
|
||||
// MAIN ---
|
||||
return main();
|
||||
})();
|
||||
1
Task/Day-of-the-week/JavaScript/day-of-the-week-4.js
Normal file
1
Task/Day-of-the-week/JavaScript/day-of-the-week-4.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
[2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]
|
||||
Loading…
Add table
Add a link
Reference in a new issue