301-Reading-Ten
Understanding the JavaScript Call Stack
- What is a ‘call’?
answer- a call invokes a function.
- How many ‘calls’ can happen at once?
answer- One call is done at a time in order from top to bottom.
- What does LIFO mean?
answer- Last in first out. The last function to be put into the stack is going to be the first function returned.
- Draw an example of a call stack and the functions that would need to be invoked to generate that call stack.
- What causes a Stack Overflow?
answer- this happens when a function calls itself, (called a recursive function) but it has no exit point.
JavaScript error messages
- What is a ‘refrence error’?
answer- when a variable is not defined
- What is a ‘syntax error’?
answer- when a language is written in properly. The grammar of a language is not correct.
- What is a ‘range error’?
answer- when a length is now a valid number or in a valid range. ex. a length cannot be negative.
- What is a ‘type error’?
answer- when you try to use a number, string, object etc… incorrectly.
- What is a breakpoint?
answer- a point in the program where your code will stop executing.
- What does the word ‘debugger’ do in your code?
answer- It can cause a breakpoint in your code and invokes any available debugging functionality-from mdn Web Docs.