'Why setTimeout works on Node JS?

I am hearing that setTimeout(), the Web API is not included in JavaScript quite often. So, if it is only Web API it is natural to think as it won't work anywhere except in the browser. So, why setTimeout is working in my terminal when I just run a plain old JS file with the node ${filename} command?



Solution 1:[1]

The browser and node.js both have a global setTimeout function, but the return types are different between the two.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dlannoye