Class 09 reading - Ginsusamurai/seattle-301d58 GitHub Wiki

Class 09 reading

Read

The Call Stack defined on MDN

  • calling a function adds it to the stack
  • functions called by that function are added on top, and all are done in the order of the stack

Understanding the JavaScript Call Stack

  • JS is single thread and single stack with LIFO (last in first out)
  • error messages show the 'stack trace' from top to bottom so what's on the bottom is the oldest item
  • stack overflow is when too many functions are in a stack, typically caused by a recursive loop

JavaScript error messages

  • Unexpected token o in JSON at position 1 means a syntax error in json (like wrong quotes)
  • debugger can make breakpoints or show the current state of variables during execution for better debugging

Reference

JavaScript errors reference on MDN