Jon Rumsey

An online markdown blog and knowledge repository.


Project maintained by nojronatron Hosted on GitHub Pages — Theme by mattgraham

Memory Usage Notes and References

Understanding the JS Call Stack

JS Q and A

What is a ‘call’?

An invokation of a function.

How many ‘calls’ can happen at once?

One.

What does LIFO mean?

It is a stack (or array) where the last item in is always the first item out.

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

[A| | | | ]
 ^
 PUSH fx(a)
[A|B| | | ]
   ^
   PUSH fx(b)
[A|B|C| | ]
     ^
     PUSH fx(c)
     POP => function(c)
     v
[A|B| | | ]
[A|B|D| | ]
     ^
     PUSH fx(d)
     POP => function(d)
     v
[A|B| | | ]
   POP => function(b)
   v
[A|B| | | ]

Etcetera.

What causes a Stack Overflow?

Googling the answers to tough coding questions.
A recursive function that calls itself without an exit condition.
More functions are placed on the stack than there is memory allocated to store them.

JS Error Messages and Debugging

Tools

Error Messages and Debugging Q and A

What is a ‘reference error’?

Attempting to use an uninitialized variable.

What is a ‘syntax error’?

Incorrect syntax was used when defining an expression.

What is a ‘range error’?

When indexing into an iterable, selecting an index ID that is not included in the iterable.

What is a ‘tyep error’?

Not sure about "tyep error" but a Type Error happens when tyring to use incompatible types together, such as an Array and a Number.

What is a breakpoint?

A developer-assigned location in the code where the RunTime will halt when reached so that value and reference types can be examined.

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

It stops code execution at the line where the keyword is.

Resources

Understanding the JS Call Stack on Free Code Camp.org
JS Error Messages and Debugging codeburst.io
MDN on javascript Errors
List of Udemy courses for full-stack developers at CodeBurst.io
Brandon Morelli on Medium.com

Back to readme.md