function firstFunction(){
console.log("Hello from firstFunction");
}
function secondFunction(){
firstFunction();
console.log("The end from secondFunction");
}
secondFunction();
What does LIFO mean?
At the most basic level, a call stack is a data structure that uses the Last In, First Out (LIFO) principle to temporarily store and manage function invocation (call). LIFO: When we say that the call stack, operates by the data structure principle of Last In, First Out, it means that the last function that gets pushed into the stack is the first to be pop out, when the function returns. Draw an example of a call stack and the functions that would need to be invoked to generate that call stack.
What causes a Stack Overflow?
A stack overflow occurs when there is a recursive function (a function that calls itself) without an exit point. The browser (hosting environment) has a maximum stack call that it can accomodate before throwing a stack error.
function callMyself(){
callMyself();
}
callMyself();
What is a ‘refrence error’? it’s object represents an error when a non-existent variable is referenced. it means when you try to use a variable that is not yet declared you get this type os errors. console.log(foo) // Uncaught ReferenceError: foo is not defined
What is a ‘syntax error’? it’s like it says itself, this occurs when you have something that cannot be parsed in terms of syntax, like when you try to parse an invalid object using JSON.parse. JSON.parse( {‘foo’: ‘bar’} ) // Uncaught SyntaxError: Unexpected token o in JSON at position 1
What is a ‘range error’? Try to manipulate an object with some kind of length and give it an invalid length and this kind of errors will show up. var foo= [] foo.length = foo.length -1 // Uncaught RangeError: Invalid array length An array for instance cannot have a negative length
What is a ‘tyep error’? it’s show 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. var foo = {} foo.bar // undefined foo.bar.baz // Uncaught TypeError: Cannot read property ‘baz’ of undefined
What is a breakpoint? debugger set breakpoints (places where code execution can be stopped), and examine variables while the code is executing. Normally, otherwise follow the steps at the bottom of this page, you activate debugging in your browser with the F12 key, and select “Console” in the debugger menu.
What does the word ‘debugger’ do in your code?
debugger who is diagnose programming code which contains errors. also Programming code might contain syntax errors, or logical errors. Many of these errors are difficult to diagnose. Often, when programming code contains errors, nothing will happen. There are no error messages, and you will get no indications where to search for errors.Searching for (and fixing) errors in programming code is called code debugging