Dates Flashcards

1
Q

Create a variable named d and assign the current date and time to it.

A

let d = new Date();

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

Use the correct Date method to extract the year (four digits) out of a date object and assign it to a variable named year.

var d = new Date();

A

year = d.getFullYear();

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

Use the correct Date method to get the month (0-11) out of a date object and assign it to a variable named month.

var d = new Date();

A

month = d.getMonth();

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

Use the correct Date method to set the year of a date object to 2020.

var d = new Date();

A

d.setFullYear(2020);

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