Search code examples
javascriptv8

setTimeout and V8


I've installed V8 standalone and execute javascript code like this: ./d8 source.js. When I use setTimeout I receive ReferenceError: setTimeout is not defined. Is this how it's supposed to be? Is it possible to somehow include this function?


Solution

  • setTimeout is not part of ECMA-262, it's implemented by the browsers. However, if you install Node.js (which is V8 + extras) you will get a command line setTimeout.