Aloysious' Codefellows Reading Notes
<== Previous Lesson Next Lesson ==>
<== Home 🏠
// Last In, First Out = L I F O
// The last function that gets pushed into the stack is the first
// to be pop out, when the function returns.
function firstFunction(){
throw new Error('Stack Trace Error');
}
function secondFunction(){
firstFunction();
}
function thirdFunction(){
secondFunction();
}
thirdFunction();
// the arrangement of the functions as a stack begins with the
// firstFunction() (which is the last function that got into the stack,
// and is popped out to throw the error),
// followed by the secondFunction(),
// and then the thirdFunction() (which is the first function that
// gets pushed into the stack when the code is executed).
Some syntax errors like sending a trailing comma when calling a function are handled without error by most recent browsers, but older ones you have to be careful.
Try to manipulate an object with some kind of length and give it an invalid length and Range Errors
will show up.
EXAMPLE :
var foo= []
foo.length = foo.length -1 // Uncaught RangeError: Invalid array length
console.log();
is a great tool for debugging.<== Home 🏠