In memory storage
Understanding the JavaScript Call Stack
- What is a ‘call’?
- it is a function invocation
- How many ‘calls’ can happen at once?
- one
- What does LIFO mean?
- last in, first out
- Draw an example of a call stack and the functions that would need to be invoked to generate that call stack.
function firstFunction(){
console.log("Hello from firstFunction");
}
function secondFunction(){
firstFunction();
console.log("The end from secondFunction");
}
secondFunction();
- What causes a Stack Overflow?
- when there is a recursive function (a function that calls itself) without an exit point
JavaScript error messages
- What is a ‘reference error’?
- try to use a variable that is not yet declared
- What is a ‘syntax error’?
- occurs when you have something that cannot be parsed in terms of syntax
- What is a ‘range error’?
- try to manipulate an object with some kind of length and give it an invalid length
- What is a ‘tyep error’?
- when the types (number, string and so on) you are trying to use or access are incompatible
- What is a breakpoint?
- a point that allows you to see what has happened before that point and you can try and evaluate the next lines
- What does the word ‘debugger’ do in your code?
- it allows you to see the history before reaching that breakpoint