Error finding Flashcards
What does this do?
function apple() {
console.log(1)
}
function apple() {
console.log(2)
}
apple();
logs 2
hoisting I guess
What does this do?
let apple = ‘apple’
[1, 2].reverse();
console.log(apple)
error
without the ; it thinks [1,2] is like an index thing apple[1, 2]
Command to enter debugger
node inspect filename.js
Command to access any variable in scope
exec variableName
Command to go to next expression of code
next
or
n
Instead of next expression, set up breakpoints in the code to stop at.
Command to go to next breakpoint
in code:
console.log(‘apple’);
debugger;
console.log(‘sauce’);
c or cont (for continue)
to go to next breakpoint
Another word for what
debugger;
does
It makes a breakpoint.
Create a breakpoint when already in debug mode
setBreakpoint()/ sb() can be used without an argument to set a breakpoint on the current line, or with a line number passed as an argument in order to set a breakpoint on the line specified.
Remove a breakpoint when already in debug mode
clearBreakpoint()/ cb()
cb(test.js, 6);
With two arguments, the name of the file and the line number.
Restart code in debug mode
run
Show more lines above and below in debugger
list()
argument for how many lines to show
n or next will just execute a function. How do you go through the lines of the function?
when on the function in the debugger:
s
List all commands
help