DEV Community 👩‍💻👨‍💻

Discussion on: What is the oddest JavaScript behavior?

Collapse
 
shayd16 profile image
Shayne Darren

I'm guessing a web app won't need a 25-day timeout or interval.

I tried a very basic test on node and it seems to be waiting on it to execute... any idea why?

Collapse
 
alexanderholman profile image
Alexander Holman • Edited on

not sure... i just ran it in node and experienced the same issue as the browser. The following line should make node print without pausing:

setInterval(() => {console.log('log')}, 2**31)

or

setInterval(() => {console.log('log')}, -1)

where the following will take 596.5 hours (roughly):

setInterval(() => {console.log('log')}, 2**31-1)

I am currently on a Windows machine running v8.9.1, perhaps its solved in later versions?