Reading-Notes

Reading

Understanding the JavaScript Call Stack

What is a ‘call’?

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 hedgeHog(){

console.log(‘Oh, hello Rabbit!’);

}

function rabbit(){

hedgeHog();

console.log(‘Good day to you as well, HedgeHog!’);

}

rabbit();

What causes a Stack Overflow?

If you have a function that calls itself within the stack, creating an infinite loop.

JavaScript error messages

What is a ‘reference error’?

Trying to use a variable that hasn’t been declared.

What is a ‘syntax error’?

The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or token order that does not conform to the syntax of the language when parsing code. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError

What is a ‘range error’?

Trying to manipulate an object with some kind of length and give it an invalid length.

What is a ‘type error’?

When the types you are trying to use or access are incompatable.

What is a breakpoint?

Tagging a line of code to delibrately turn it off.

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

Activates the breakpoint on that line.