In node:12.19.0-slim docker image setTimeout function returns a value for which isNaN=false
In node:12.18.4-slim docker image setTimeout function returns a value for which isNaN=true
timeoutId = setTimeout(function() {alert("Timeout")}, 1000);
console.log(isNaN(timeoutId))

Is this an intentional behaviour?
Is this an intentional behaviour?
It was indeed an intentional change. https://github.com/nodejs/node/pull/34017
I wonder if perhaps that would have ideally been treated as semver-major, but I can see why that wasn't obvious at the time.
@lundibundi @nodejs/timers
I don't have much to add - the change is definitely something that should have happened at some point. The current maintainers will need figure out what, if anything, to do about this situation.
Thank you for clarification.
@kefasb just to point out - this change should have probably been communicated better and semver-major if people "in the wild" are running into cases where code that checks for node vs. browser timers is starting to fail.
The idea was to make node timers _easier_ to work with and this sort of usage pattern (someone using isNaN to check if the timer they got was a web browser) was missed on our part.
Sorry for breaking your code!
Most helpful comment
I don't have much to add - the change is definitely something that should have happened at some point. The current maintainers will need figure out what, if anything, to do about this situation.