Skip to content

Latest commit

 

History

History
63 lines (35 loc) · 1.62 KB

301-class-10.md

File metadata and controls

63 lines (35 loc) · 1.62 KB

Notes on Memory Storage

Understanding the JavaScript Call Stack

  • What is a ‘call’?

A function invocation.

  • How many ‘calls’ can happen at once?

Just one.

  • What does LIFO mean?

It stands for Last In, First Out and means that the last function tto be pushed into the stack is the first one that is going to come out.

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

To have a function where you take the average of two numbers, you can have a function built into it that adds them and use it as a call stack, like so:

function add(x,y) {
  return x+y;
}

function avg(x,y) {
  return add(x,y)/2;
}
  • What causes a Stack Overflow?

When a function calls itself (recursive) but does not have an exit point.

JavaScript error messages

  • What is a ‘refrence error’?

Attempting to use a variable that has yet to be declared.

  • What is a ‘syntax error’?

The result of not using the proper syntax such that the code statement cannot be parsed.

  • What is a ‘range error’?

The result of giving an object invalid length when attempting to manipulate/use it.

  • What is a ‘tyep error’?

A type error happens when attempts are made for incompatible types to interact (like a string interacting with a number when the conditions don't allow for it).

  • What is a breakpoint?

The point when the code stops executing.

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

Allows you to see the "history" of the code execution before the breaking point was reached.

Things I want to know more about

I'm interested in incorporating debugger statements.