Question

The standalone V8 shell (d8) does not come with a console object, so I cannot do console.log. How do I print stuff to stdout?

Was it helpful?

Solution

Use the print function instead of console.log. For instance:

$ cat test.js
print('foo');
$ ~/src/v8/out/native/d8 test.js
foo

Head over to Sandeep Datta's blog post for more info on d8 helper functions like print.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top