View on GitHub

reading-notes

Understanding the JavaScript Call Stack

What is a ‘call’?

How many ‘calls’ can happen at once?

What does LIFO mean?

an example of a call stack and the functions that would need to be invoked to generate that call stack

function firstFunction(){
  throw new Error('Stack Trace Error');
}

function secondFunction(){
  firstFunction();
}

function thirdFunction(){
  secondFunction();
}

thirdFunction();

Stack trace error Stack trace error

What causes a stack overflow?

In summary

The key takeaways from the call stack are:

  1. It is single-threaded. Meaning it can only do one thing at a time.

  2. Code execution is synchronous.

  3. A function invocation creates a stack frame that occupies a temporary memory.

  4. It works as a LIFO — Last In, First Out data structure.


JavaScript error messages

What is a ‘refrence error’?

What is a ‘syntax error’?

What is a ‘range error’?

What is a ‘tyep error’?

*this how up when the types (number, string and so on) you are trying to use or access are incompatible, like accessing a property in an undefined type of variable.

What is a breakpoint?

What does the word ‘debugger’ do in your code?

Conclusion


### refrences