JavaScript Basics Flashcards

1
Q

What is the data type that is missing: string, number, boolean, null…

A

undefined

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

What is the instruction to display something in the console?

A

console.log

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

How do you comment a single line?

A

//

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

Instruction to display a message in a pop up window

A

alert

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

Instruction to display the kind of variable

A

typeof

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

What is the data type that is missing: string, number, boolean, undefined…

A

null

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

How to comment multiple lines?

A

/**/

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

Instruction to display a field in a pop up window?

A

prompt

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

What is the sign used to check if a variable is equal to something?

A

===

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

How do you code AND?

A

&&

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

How do you code OR?

A

||

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

If you are older than 18 you can drink beer, if not you can drink juice. How do you code this using the 2 following variables: beverage and age?

A

var beverage = age > 18 ? ‘beer’ : ‘juice’;

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

What is used in a switch statement?

A

case and break

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

What would you use in a switch statement to assign a value that is not assigned by “case”?

A

default

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

What would you use if you want to use an equality operator with a string and a number?

A

==

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

What should replace XXXXX if you want to use the result later?

function calculateAge(birthYear) {
    XXXXX 2018 - birthYear;
}
A

return

17
Q

What does DRY mean?

A

Don’t repeat yourself