Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,11 @@
function range(m, n) {
return Array.apply(null, Array(n - m + 1)).map(
function (x, i) {
return m + i;
}
);
}
console.log(
range(1, 10).join(', ')
);

View file

@ -0,0 +1 @@
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

View file

@ -0,0 +1,21 @@
function range(m, n) {
return Array.apply(null, Array(n - m + 1)).map(function (x, i) {
return m + i;
});
}
console.log(
(function (nFrom, nTo) {
var iLast = nTo - 1;
return range(nFrom, nTo).reduce(
function (accumulator, n, i) {
return accumulator +
n.toString() +
(i < iLast ? ', ' : ''); // conditional sub-expression
}, ''
)
})(1, 10)
);

View file

@ -0,0 +1 @@
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

View file

@ -0,0 +1,4 @@
var s=1, e=10
for (var i=s; i<=e; i+=1) {
document.write( i==s ? '' : ', ', i )
}

View file

@ -0,0 +1,6 @@
var s=1, e=10
for (;; s+=1) {
document.write( s )
if (s==e) break
document.write( ', ' )
}