Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Nth/JavaScript/nth-1.js
Normal file
24
Task/Nth/JavaScript/nth-1.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
console.log(function () {
|
||||
|
||||
var lstSuffix = 'th st nd rd th th th th th th'.split(' '),
|
||||
|
||||
fnOrdinalForm = function (n) {
|
||||
return n.toString() + (
|
||||
11 <= n % 100 && 13 >= n % 100 ?
|
||||
"th" : lstSuffix[n % 10]
|
||||
);
|
||||
},
|
||||
|
||||
range = function (m, n) {
|
||||
return Array.apply(
|
||||
null, Array(n - m + 1)
|
||||
).map(function (x, i) {
|
||||
return m + i;
|
||||
});
|
||||
};
|
||||
|
||||
return [[0, 25], [250, 265], [1000, 1025]].map(function (tpl) {
|
||||
return range.apply(null, tpl).map(fnOrdinalForm).join(' ');
|
||||
}).join('\n\n');
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue