Skip to main content
All output goes to stderr, every argument is printed (joined with a space), and every method returns undefined.

Methods

Timers

Output is integer milliseconds measured on the wall clock (CLOCK_REALTIME), printed as label: 12ms. Unknown labels warn instead of throwing:
Calling timeEnd twice warns — the label is removed once ended. timeLog may be called repeatedly while the timer runs.

Everything goes to stderr

That’s deliberate: stdout stays clean for program output (JSON you pipe to jq, a generated file listing), while diagnostics stay visible in a terminal.

Arguments

Every argument is printed, converted with standard toString semantics:
  • Objects print as [object Object] — serialize explicitly if you want structure.
  • A single line is buffered up to 4096 bytes; longer lines flush in chunks, so a huge argument still prints in full.
  • console.log.length is 2 and console.time.length is 1 — the arity QuickJS reports. Don’t rely on it.

Gotchas

  • stderr, not stdout. console.log > file captures nothing.
  • No console.table, console.trace, console.assert, console.count — they’re not defined; calling them throws TypeError.
  • Colours are raw ANSI escapes; piping to a file keeps the escape codes.
  • Timers use wall-clock time, so an NTP step can make a duration look negative or huge. For measurements, prefer performance.now().

See also