Working with JavaScript Flashcards

(30 cards)

1
Q

What is Debugging?

A

Debugging is the process of identifying and fixing errors in a code.

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

What is Logging?

A

Logging is a way to check code as it’s being developed.

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

What does Logging look like?

A

Logging looks like the printing of values to a display as the code runs.

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

What is the Console?

A

The Console is a tool which displays feedback like logs, and errors when things go wrong.

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

What do you write in JavaScript to ‘print’ something to the Console?

A

In JavaScript, you write console.log() to ‘print’ something to the Console.

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

What does console.log() let you see?

A

console.log() lets you see the output when the code is ran.

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

What will console.log(‘hello’) print to the console?

A

hello

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

What will console.log(4) print to the console?

A

4

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

What will console.log(4+10) print to the console?

A

14

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

Can Debugging check the data types of Variables?

A

Yes, Debugging can check the data types of variables.

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

What does the typeof operator do?

A

the typeof operator can tell you what kind of data type any kind of value is.

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

Can the typeof operator tell you what kind of data type values stored within variables are?

A

Yes

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

How do you see the data type printed to the console?

A

Combine the typeof operator with the console.log() to see the data type printed to the console.

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

What type will print to the console?

console.log(typeof ‘hello’);

A

the console will print the type ‘string’

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

What type will print to the console?

console.log(typeof 4);

A

the console will print the type ‘number’

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

What type will print to the console?

console.log(typeof(9+5));

A

the console will print the type ‘number’

17
Q

Why is there an extra bracket?

console.log(typeof(9+5));

A

There is an extra bracket because the expression needs to evaluate itself first before it can identify the final data type.

18
Q

What type will print to the console?

console.log(typeof name);

A

The console will print the type ‘string’

19
Q

What are Comments?

A

Comments in JavaScript are text within code that are ignored by the JavaScript Coding Engine when running the code.

20
Q

What are Comments used as a Tool for?

A

Comments are used as a tool for Planning and for communication with other developers. It’s good for trying to recall the reason behind doing something the way you did.

21
Q

What is the syntax for Single-Line Comments?

A

// is the syntax for single line comments

22
Q

What is the syntax for Double-Line Comments?

A

/* is the syntax for multi line comments

23
Q

Is the syntax for Double-line comments reversed at the end?

24
Q

What is Pseudocode?

A

Pseudocode is the common term given to code that expresses a sequence of code in human language.

25
What is one way to achieve pseudocode?
comments are one way of achieving pseudocode.
26
What is an Error Message?
An Error Message is a type of feedback that occurs when something goes wrong. They assist with debugging code.
27
What is an example of a syntax error?
const food = 'cheese" is an example of a syntax error
28
When does a reference error occur?
A reference error occurs when a code attempts to use a variable that isn't available or hasn't been declared before the time we use it.
29
Why would this code cause an error? console.log(food); const food='cheese';
It would cause an error because the variable has been logged before it has been declared.
30
When does a Type Error Occur?
A Type Error will Occur when we attempt to use a data type in a way that isn't permitted.