Week 2 Review Flashcards
1
Q
if statement
A
if(boolean expression){
};
2
Q
Difference between == and ===
A
=== has no type conversion
3
Q
if-else statement
A
if(boolean experession){
} else {
}
4
Q
The “and” operator
A
&&
5
Q
The “or” operator
A
||
6
Q
the “not” operator
A
!
7
Q
switch statement
A
switch(variable) { case var_val_1: break; case var_val_2: break; default: }
8
Q
while statement
A
while (boolean) {
}
9
Q
for statement
A
for (let i =1; i<5, i++){ }
10
Q
declare a variable a with string value
A
a = “ a sentence”; or a = ‘a sentence’;
11
Q
Operator to concatenate a string
A
+
12
Q
concatinate a string with +=
A
String1 = ‘one’
String1 += ‘two’
13
Q
find length of string
A
myString = “William”
myString.length
14
Q
get second character of a string
A
myString = ‘William”
myString[1]
15
Q
Create an array in JS
A
myArray[]