πŸ‡ RVKlein @rvk

Just discovered an interesting method to deduce environment runtime context in JavaScript by getting the primitive type and constructor of the returned value of the setTimeout function. In NodeJS it returns an object with the constructor name of Timeout. In a web browser, in either a worker or window, setTimeout returns a number reference to the Timeout/Interval handler. Neat shit.

Β· Whalebird Β· 0 Β· 0