2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
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);
|
||||
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue