curriculum/challenges/english/blocks/quiz-javascript-dates/66edd3711bb9f7efa73aef91.md
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
What is the JavaScript Date object used for?
Work with just dates only.
Work with just time only.
Work with just leap years.
Work with both dates and time.
Which code creates a new Date object instance?
Date.new()
Date.fetch()
new.Date()
new Date()
How does Date.now() work?
It returns the current time in nanoseconds since July 4, 1776.
It returns the previous time in milliseconds since January 1, 1974.
It returns the current date in minutes since January 1, 1970.
It returns the current time in milliseconds since January 1, 1970.
Which method returns the current year?
getNewYear()
getLastYear()
getLeapYear()
getFullYear()
Which method returns the current month, as a zero-indexed integer?
getCalendar()
fetchMonth()
get.Month()
getMonth()
Which method formats a date as a string?
getMonth()
formatDate()
toStingy()
toString()
What would the result of console.log(new Date().getFullYear()); be, if it is June 12th 2022?
"June 12th 2022"
"2023"
"06/12/2022"
"2022"
What does fr-FR in date.toLocaleDateString("fr-FR") represent?
A French-Canadian locale.
A French-Italian locale.
A French-Finnish locale.
A French locale.
If the time in your locale is formatted as HH:MM:SS AM/PM, which line of code would correctly display the current time?
console.log(new Date().toLocaleDateString());
console.log(new Date().toString());
console.log(new Date().toCityDateString());
console.log(new Date().toLocaleTimeString());
In which format does the toISOString() method return a date?
A USA-863 string format.
An MP3 string format.
A UTC string format.
An ISO-8601 string format.
What should an ISO-8601 date format look like?
DD-MM-YYYY
DD-MM-YYTHH
YYYY-MM-DDTHH:mm:ssZ
YYYY-MM-DDTHH:mm:ss.sssZ
What is the corresponding month for console.log(new Date(2003, 6, 27).getMonth());?
June
April
January
July
How would you format a date to a locale-specific string or a more readable format?
.toLocaleDate()
.toLocaleString()
.toLocaleTimeString()
.toLocaleDateString()
What is the default locale used by the toLocaleDateString() method if no locales parameter is provided?
English (Great Britain).
The locale closest to United States.
French (France).
The user's system locale.
What gets assigned to now in the code below?
const now = new Date();
The current time in milliseconds since January 1, 1990.
The current date in milliseconds minus the Unix epoch.
The current time in nanoseconds since January 1, 1990.
The current date and time based on your computer system's clock.
What is the output of console.log(new Date(2003, 6, 27).getFullYear());?
"27/6/2003"
27
6
2003
What does getDate return when the date is invalid?
0
null
undefined
NaN
If we are in the month of October, what will console.log(new Date().getMonth()); output?
1
3
10
9
Which option will output 2021 for the following object?
const d = new Date("2021-12-25");
console.log(d.getTime())
console.log(d.toUTCString())
console.log(d.getDate())
console.log(d.getFullYear())
Which option will output "2021-12-25T00:00:00.000Z" for the following object?
const d = new Date("2021-12-25");
console.log(d.getFullYear())
console.log(d.toUTCString())
console.log(d.getTime())
console.log(d.toISOString())