Lecture 5: Javascript: Basics Flashcards

1
Q

Variables

A

let message = ‘Welcome’

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

Variable declaration

A

Let: for true variables you might want to re-assign
Const: for variables that are not re-assigned
Var: old, replaced by ‘let’.

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

Types

A

No Types are declared, JS dynamically assigns data types.

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

Variable names

A

cannot start with numbers, cannot start with keywords and ARE case-sensitive

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

Number

A

Numeric types(64 float)

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

String

A

text

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

Boolean

A

true/false

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

Null

A

lack of value

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

Undefined

A

never defined

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

Strict Equality

A

===

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

If statement

A

if(i === 6){
Do Something
}
else{
Do something else
}

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

What is True or False?
All evaluated as false:

A

False, null, undefined, “”, 0, NaN

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

What is True or False? All evaluated as True

A

True, “hello”, “false”, 1, -1

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

Arrays

A

A collection of data
Zero-based indexing
Example:
Let students = [“Alex”, “Ralph”, “Michael”, “Eric”];

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

for loop

A

Classic for loop. Counting things & operating via indices
for( let i = 0; i <students.length; i++){
Let name = students[i];
console.log(“Hi “ + name + “! You are at spot “ + i);}

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

for of loop

A

for(let name of students){
console.log(“Hi “ + name + “! );}