Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,14 @@
function loop_plus_half(start, end) {
var str = '',
i;
for (i = start; i <= end; i += 1) {
str += i;
if (i === end) {
break;
}
str += ', ';
}
return str;
}
alert(loop_plus_half(1, 10));

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( ', ' )
}