orget it, nvm
iberian Huskies on the
I've done a glance over on your site via a VPN

  Main Index Search Posts Who's Online Log in LOG
IN

Free Games Forum
:
Technology
:
Programming
:
[NSFW] [Tutorial] Loop in JavaScript

 



jeff
Surgeon / Chief Medical Officer


Feb 3, 2018, 7:04 PM

Post #1 of 12 (2796 views)
Shortcut
[NSFW] [Tutorial] Loop in JavaScript Can't Post

(let g=0;g<=10;g++) { 
console.log(g);
};

Later..jeff...Cool...
Medical Doctor & Retired TV Technician

(Tyler Gibney fucked around with this message on Feb 3, 2018, 9:35 PM)


Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 8:07 PM

Post #2 of 12 (2792 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
var loop = (g, stop, f) => {
if (g <= stop) {
f(g);
loop(g+1, stop, f);
}
};

loop(0, 10, console.log);


(Tyler Gibney fucked around with this message on Feb 3, 2018, 8:21 PM)


Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 8:07 PM

Post #3 of 12 (2791 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
var loop = function*(start, stop) {
let g = start;
while (g <= stop) yield g++;
};

for (let g of loop(0, 10)) console.log(g);



Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 8:13 PM

Post #4 of 12 (2786 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
var loop = new Array(10+1);

$.each(loop, function(g) {
console.log(g);
});



Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 8:30 PM

Post #5 of 12 (2784 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
var loop = (start, g) => {
return g < start ? [] : loop(start, g-1).concat(g);
};

loop(0, 10).forEach(g => console.log(g));


(Tyler Gibney fucked around with this message on Feb 3, 2018, 8:36 PM)


Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 8:43 PM

Post #6 of 12 (2782 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
$("tr").slice(0, 10+1).each(function(g) {
console.log(g);
});


(Tyler Gibney fucked around with this message on Feb 3, 2018, 8:43 PM)


Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 9:04 PM

Post #7 of 12 (2778 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
var loop = [];
{
let stack = new Array(10+1);
while (stack.length) {
stack.pop();
loop.unshift(stack.length);
}
}

loop.forEach(g => console.log(g));


(Tyler Gibney fucked around with this message on Feb 3, 2018, 9:06 PM)


Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 9:09 PM

Post #8 of 12 (2775 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

 
for (let start = 0, stop = 10, f = console.log, g = start; g <= stop; f(g++));



Tyler Gibney
Veteran / Veteran Controller / Moderator


Feb 3, 2018, 9:29 PM

Post #9 of 12 (2774 views)
Shortcut
Re: [jeff] [Tutorial] Loop in JavaScript [In reply to] Can't Post

Only for genius ?? (Click to view)



(Tyler Gibney fucked around with this message on Feb 8, 2018, 1:04 AM)


Mikey the Diamond Miner
Banished from Programming Forum

Feb 7, 2018, 12:13 AM

Post #10 of 12 (2724 views)
Shortcut
Re: [Tyler Gibney] [Tutorial] Loop in JavaScript [In reply to] Can't Post





(Mikey the Diamond Miner fucked around with this message on Feb 7, 2018, 1:22 AM)


Mikey the Diamond Miner
Banished from Programming Forum

Feb 7, 2018, 12:53 AM

Post #11 of 12 (2716 views)
Shortcut
Re: [Mikey the Diamond Miner] [Tutorial] Loop in JavaScript [In reply to] Can't Post

var g=0, stop=10, next =()=> g<stop && g++; 
do console.log(g); while (typeof next() != 'boolean');


(jeff fucked around with this message on Feb 7, 2018, 10:15 PM)


jeff
Surgeon / Chief Medical Officer


Feb 7, 2018, 4:34 AM

Post #12 of 12 (2691 views)
Shortcut
Re: [Mikey the Diamond Miner] [Tutorial] Loop in JavaScript [In reply to] Can't Post

$.map([...Array(parseInt(1011, 2)).keys()], f=g=>console.log(g));

Later..jeff...Cool...
Medical Doctor & Retired TV Technician

(jeff fucked around with this message on Feb 7, 2018, 10:16 PM)

 
 


Search for (options) Free Games Forum Refugees