Javascript Basics & Flow Control Flashcards

1
Q

What are the five primitive data types?

A
  1. Numbers
  2. Strings
  3. Booleans
  4. Undefined
  5. Null
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Modulo/Mod?

A

A “%” sign

52 % 5

=2

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

What is concatenations?

A

When two stings are added together!

“Aaron” + “ Scott”

or

“Aaron” + “ “ + “Scott”

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

How do you open the JavaScript Console in Chrome

A

Control + Shift + J

Command + Shift + J

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

What does a “" do in JS strings?

A

Allows you to see invisible items if placed directly before/after

‘what/’s up?’

=what’s up?

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

What type of case is JS?

A

camelCase

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

How do you comment out in JS

A

//

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

What is Ampersand

A

&&

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

What is Ampersand Ampersand?

A

&& = And

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

What is the pipe?

A

|| = or

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

What is the bang?

A

! = Not

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

What 6 things are falsey?

A
  1. False
  2. 0
  3. Empty String or “”
  4. Undefined
  5. Null
  6. NaN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Dry?

A

Do not repeat yourself

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

<=

A

Less then or equal to

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

how do you write does not equal?

A

!=

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

== vs ===

A

== uses type coecrion

(Makes the two types the same)

===

(Must be the same type, and same value)

17
Q

if

else if

else

(Define)

A

Use if to specify a block of code to be executed, if a specified condition is true

Use else if to specify a new condition to test, if the first condition is false

Use else to specify a block of code to be executed, if the same condition is false

18
Q

The only thing that’s built in to JS that in capital is…

A

Methods

19
Q

if

else if

else

(Example)

A

if (time < 10) {
greeting = “Good morning”;
} else if (time < 20) {
greeting = “Good day”;
} else {
greeting = “Good evening”;
}

20
Q

What does unit+=5 mean?

A

Unit+5

21
Q

What does Unit++ mean?

A

Add 1

22
Q

While loop

(Define)

A

The while loop loops through a block of code as long as a specified condition is true.

23
Q

While Loop

(Syntax)

A

Syntax

while (condition) {
code block to be executed

}

24
Q

For Loop Defined… & Syntax

A

Define

The for statement creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement) to be executed in the loop.

Syntax

for(init; condition; step){

}

25
Q

Example of for loop

A

for(i = 5; i < 50; i++)
{
if(i % 5===0 && i % 3===0){
console.log(i)
}
}