Javascript Flashcards

1
Q

Javascript

Variables

A
var dog;
let dog = 'string';
const dog;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Javascript

How do you write the T/F boolean?

A

True
False

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

Javascript

The Abscense of a value

A

Null

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

Javascript

Undefined

A

A variable that does not yet have an assigned value

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

Javascript

For giant math

A

BigInt

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

Javascript

Symbol data type

A
const sym1 = Symbol();
const sym2 = Symbol("foo");
const sym3 = Symbol("foo");

sym2 != sym3 

Guaranteed unique

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

Javascript

And

A

&&

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

Javascipt

Or

A

||

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

Javascript

Not

A

!

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

Javascript

Difference between == & ===

A
3 === will check for strict equality. 
100 != "100"
2 equal objects will not be equal because they are different objects
!== will check for strict inequality
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Javascript

If Statements

A
if ('this' == false) {
   //do stuff
} else if ('this' == 'cake') {
  // other stuff
} else {
   //
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Javascript

Switch Statement

A
switch (place) {
    case 'first':
        // do stuff 
        break; 
    case 'second':
        // do stuff
        break;
    default: 
        break;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Javascript

For Loop

A
for (var i = 5; i > 0; i--) {
    console.log(i);
};
console.log('Countdown finished!');
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Javascript

While Loop

A
var i = 5;
while (i > 0) {
    console.log(i);
    i = i - 1;
};
console.log('Counting completed!');
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Javascript

Functions

A
// A function that accepts two parameters
function letterFinder(word, match) {
    // do stuff 
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Javascript

Objects

A
var drone = {
    speed: 100,
    altitude: 200,
    color: "red"
}

var car = {};
car.color = "red";
car["color"] = "green";
17
Q

Javascript

Fat Arrow Functions

A
var addValues = (x, y) => {
  return x + y
}

asyncFunction()
  .then(() => asyncFunction1())
  .then(() => asyncFunction2())
  .then(() => finish);

Arrow functions shine best with anything that requires this to be bound to the context, and not the function itself.

Despite the fact that they are anonymous, I also like using them with methods such as map and reduce, because I think it makes my code more readable. To me, the pros outweigh the cons.