Error finding Flashcards

1
Q

What does this do?
function apple() {
console.log(1)
}

function apple() {
console.log(2)
}

apple();

A

logs 2
hoisting I guess

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does this do?

let apple = ‘apple’

[1, 2].reverse();

console.log(apple)

A

error
without the ; it thinks [1,2] is like an index thing apple[1, 2]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to enter debugger

A

node inspect filename.js

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Command to access any variable in scope

A

exec variableName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command to go to next expression of code

A

next
or
n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Instead of next expression, set up breakpoints in the code to stop at.
Command to go to next breakpoint

A

in code:
console.log(‘apple’);
debugger;
console.log(‘sauce’);

c or cont (for continue)
to go to next breakpoint

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Another word for what
debugger;
does

A

It makes a breakpoint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Create a breakpoint when already in debug mode

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Remove a breakpoint when already in debug mode

A

clearBreakpoint()/ cb()
cb(test.js, 6);
With two arguments, the name of the file and the line number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Restart code in debug mode

A

run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Show more lines above and below in debugger

A

list()
argument for how many lines to show

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

n or next will just execute a function. How do you go through the lines of the function?

A

when on the function in the debugger:
s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List all commands

A

help

How well did you know this?
1
Not at all
2
3
4
5
Perfectly