Basic 4 (date) Flashcards

1
Q
Ho can you get new data and find the:
Day
month
full year
hours
minutes
Milliseconds
Time
A
val = today.getDay();
val = today.getMonth();
val = today.getDay()
val = today.getFullYear();
val = today.getHours();
val = today.getMinutes();
val = today.getMilliseconds();
val = today.getTime();
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can you set a value to customize a date?

A

birthday. setMonth(3)
birthday. setDate(12);
birthday. setFullYear(1981);
birthday. setHours(3);
birthday. setMinutes(30);

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

Place the 4 different ways of equality in here and what is the recommended one?

A

These two are recommended.

==
!=

!==

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

do an if statement with everything that it takes (declared variable, if, and else)

A

const id = 100;

// EQUAL TO

if(id === 100){
  console.log('CORRECT');
} else {
  console.log('INCORRECT');
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how do I test if it’s undefined?

A
if(typeof id !== 'undefined'){
  console.log(`The is ID ${id}`);
} else {
  console.log ('No ID');
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

GREATER OR LESS THAN

A
if(id > 200){
  console.log('CORRECT');
} else {
  console.log('INCORRECT');
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

IF ELSE

A

const color = ‘red’;

if(color === 'red'){
  console.log('Color is red');
} else if (color === 'blue'){
  console.log('Color is blue');
} else {
  console.log('Color is not red or blue');
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly