Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

run a nodejs file infinite loop

function logEvery2Seconds(i) {
    setTimeout(() => {
        console.log('Infinite Loop Test n:', i);
        logEvery2Seconds(++i);
    }, 2000)
}

logEvery2Seconds(0);

let i = 0;
setInterval(() => {
    console.log('Infinite Loop Test interval n:', i++);
}, 2000)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #run #nodejs #file #infinite #loop
ADD COMMENT
Topic
Name
1+9 =