Debugging Flashcards

1
Q

What are the Chrome and Firefox Javascript consoles also known as?

A

DevTools

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

What are DevTools used for?

A

To debug Javascript code.

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

What’s considered the most helpful debugging tool?

How is it best used?

A

console.log()

Placing it at strategic points in your code can show you the intermediate values of variables. It’s good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is.

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

What’s the output of the code below?

A

In order, the console will display the strings string, number, object, and object.

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

Of the primitive types in Javascript, which ones are mutable?

A

Only the object type is mutable.

(In Javascript, arrays are a type of object).

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

List the 8 most common syntax errors?

A
  • Spelling
  • Unclosed brackets, braces, parethesis and quotes
  • Mixing single and double quotes
  • Using asignment operator instead of equality operator
  • Missing open and closing parethesis after a function call
  • Arguments passed in the wrong order when calling a function
  • Off-by-one error(OBOE) when using indexing
  • Reinitialising(or not) variables inside loops
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the “falsy” values?

Which values are not “falsy”?

A

false, 0, null, “”, undefined and NaN.

All other values on their own resolve to true in Javascript.

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

What are two common causes of infinite loops?

A

One error is incrementing or decrementing a counter variable in the wrong direction from the terminal condition. Another one is accidentally resetting a counter or index variable within the loop code, instead of incrementing or decrementing it.

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