JavaScript theorytheory 0/50 · 0%
Tooling · easy

20. Debugging and the console

console methods, breakpoints and reading a stack trace.

`console.log` is only the start: `console.table` prints arrays of objects, `console.time`/`timeEnd` measures, `console.error` gets a stack trace, and `debugger` pauses in devtools.

Read stack traces from the top: the first frame in your own file is usually where the bug is.

console.table(txs);
console.time("rpc"); await call(); console.timeEnd("rpc");

For Web3 debugging, log the raw JSON-RPC error object — the useful message usually hides in `error.data` or `error.cause`.

Check your understanding

  1. 1. Which console method prints tabular data?

  2. 2. How should you read a stack trace?

  3. 3. Where do useful RPC error details often live?