Understanding the JavaScript Call Stack
- What is a ‘call’?
- The call() allows for a function/method belonging to one object to be assigned and called for a different object. … With call() , you can write a method once and then inherit it in another object, without having to rewrite the method for the new object.
2.How many ‘calls’ can happen at once?
3.What does LIFO mean?
- LIFO: When we say that the call stack, operates by the data structure principle of Last In, First Out, it means that the last function that gets pushed into the stack is the first to be pop out, when the function returns.
4.Draw an example of a call stack and the functions that would need to be invoked to generate that call stack.
- Here is the example:
function firstFunction(){ console.log(“Hello from firstFunction”); }
function secondFunction(){ firstFunction(); console.log(“The end from secondFunction”); } secondFunction();
5.What causes a Stack Overflow?
- The most-common cause of stack overflow is excessively deep or infinite recursion, in which a function calls itself so many times that the space needed to store the variables and information associated with each call is more than can fit on the stack.

JavaScript error messages
- What is a ‘refrence error’?
- An #REF error (the “ref” stands for reference) is the message Excel displays when a formula references a cell that no longer exists, usually caused by deleting cells that a formula is referring to.
2.What is a ‘syntax error’?
- Syntax errors are mistakes in the source code, such as spelling and punctuation errors, incorrect labels, and so on, which cause an error message to be generated by the compiler.
3.What is a ‘range error’?
- Description. A RangeError is thrown when trying to pass a value as an argument to a function that does not allow a range that includes the value. This can be encountered when: passing a value that is not one of the allowed string values to String.
4.What is a ‘tyep error’?
- The TypeError object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator or function
5.What is a breakpoint?
- A breakpoint is a point in the program where the code will stop executing. For example, if the programmer amended the logic error in the trace table example they may wish to trigger a break point at line 5 in the algorithm.
6.What does the word ‘debugger’ do in your code?
- Definition: Debugging is the process of detecting and removing of existing and potential errors (also called as ‘bugs’) in a software code that can cause it to behave unexpectedly or crash. To prevent incorrect operation of a software or system, debugging is used to find and resolve bugs or defects.
