Errors and debugging

Handle failures, and find bugs with the browser tools.

Expected output
1
null

Debugging habits

  • Press F12 and read the Console. The error names the file and line.
  • Add the word debugger; to pause there with the tools open.
  • Use the Network tab to see what a failed request actually returned.
  • Check your assumption with console.log before changing any code.
โ† Async and fetchJavaScript quick reference โ†’