Assignment Operators, Comparison Operators, Conditionals, and Ternaries Flashcards
1
Q
What data type is this an example of? let example = 'Hello';
A
String
2
Q
What data type is this an example of? let example = 0;
A
Integer
3
Q
What data type is this an example of? let example = true;
A
Boolean
4
Q
Rewrite the following as a Switch:
let test = 5; if (typeof test === 'string') { console.log("It's a string!"); } else if (typeof test === 'number') { console.log("It's a number!"); } else if (typeof test === 'boolean') { console.log("It's a boolean!"); } else { console.log("It's something else!") }
A
switch (typeof test) { case 'string': console.log("It's a string!"); break; case 'number': console.log("It's a number!"); break; case 'boolean': console.log("It's a boolean!"); break; default: console.log("It's something else!"); break; }
5
Q
What will the following console log?
let test = '3'; if (test === 3){ console.log('Yep!') } else { console.log('Nope!') }
A
Nope!
6
Q
What will the following console log?
let test = 3; if (test === 3){ console.log('Yep!') } else { console.log('Nope!') }
A
Yep!
7
Q
What will the following console log?
let test = '3'; if (test == 3){ console.log('Yep!') } else { console.log('Nope!') }
A
Yep!
8
Q
Objects are ‘____’ - ‘____’ pairs
A
key-value
9
Q
Subtraction assignment operator
A
x -= 1
10
Q
Addition assignment operator
A
x += 1
11
Q
Multiplication assignment operator
A
x *= 1
12
Q
Division assignment operator
A
x /= 1
13
Q
Remainder (or modulus) operator
A
x %= 1
14
Q
Exponential assignment operator
A
x **= 1
15
Q
Equal comparison operator
A
==