refactor(curriculum): JavaScript date quiz (#58477)

Co-authored-by: Dario-DC <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
Zaira 2025-02-04 18:57:27 +05:00 committed by GitHub
parent a04afd6cfd
commit baaf46efdd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,7 +29,7 @@ Work with just time only.
---
None of the others.
Work with just leap years.
#### --answer--
@ -109,7 +109,7 @@ Which method returns the current month, as a zero-indexed integer?
#### --distractors--
`getCalender()`
`getCalendar()`
---
@ -171,27 +171,23 @@ What would the result of `console.log(new Date().getFullYear());` be, if it is J
#### --text--
What will be the output of the following code?
```js
console.log(new Date("2023-06-18T12:00:00Z").toUTCString());
```
What does `fr-FR` in `date.toLocaleDateString("fr-FR")` represent?
#### --distractors--
`"Mon, 19 Jun 2023 12:00:00 GMT"`
A French-Canadian locale.
---
`"Sun, 18 Jun 2023 12:00:00 GMT+1"`
A French-Italian locale.
---
`"Sun, 18 Jun 2023 13:00:00 GMT"`
A French-Finnish locale.
#### --answer--
`"Sun, 18 Jun 2023 12:00:00 GMT"`
A French locale.
### --question--
@ -219,7 +215,7 @@ If the time in your locale is formatted as `HH:MM:SS AM/PM`, which line of code
#### --text--
How does the `toISOString()` method format a date?
In which format does the `toISOString()` method return a date?
#### --distractors--
@ -263,23 +259,23 @@ YYYY-MM-DDTHH:mm:ss.sssZ
#### --text--
What is the output of `console.log(new Date(2003, 6, 27).getMonth());`?
What is the corresponding month for `console.log(new Date(2003, 6, 27).getMonth());`?
#### --distractors--
`"27/6/2003"`
June
---
`27`
April
---
`2003`
January
#### --answer--
`6`
July
### --question--
@ -307,50 +303,49 @@ How would you format a date to a locale-specific string or a more readable forma
#### --text--
Which option will correctly create a string representing January 1, 2025?
```js
const d = ?;
console.log(d.toISOString().split("T")[0]);
```
What is the default locale used by the `toLocaleDateString()` method if no `locales` parameter is provided?
#### --distractors--
`const d = new Date("2021-02-01");`
English (Great Britain).
---
`const d = new Date("2003-06-06");`
The locale closest to United States.
---
`const d = new Date("2001-04-08");`
French (France).
#### --answer--
`const d = new Date("2025-01-01");`
The user's system locale.
### --question--
#### --text--
What does `new Date().getDay()` return?
What gets assigned to `now` in the code below?
```js
const now = new Date();
```
#### --distractors--
It returns the current day of the week as a string. Starting with Friday as `0`.
The current time in milliseconds since January 1, 1990.
---
It returns the current day of the year as a number. Starting with Monday as `0`.
The current date in milliseconds minus the Unix epoch.
---
It returns the current day of the month as a decimal. Starting with Sunday as `1`.
The current time in nanoseconds since January 1, 1990.
#### --answer--
It returns the current day of the week as a number. Starting with Sunday as `0`.
The current date and time based on your computer system's clock.
### --question--
@ -378,23 +373,23 @@ What is the output of `console.log(new Date(2003, 6, 27).getFullYear());`?
#### --text--
The `toUTCString()` method formats a date as?
What does `getDate` return when the date is invalid?
#### --distractors--
A door dash string format.
`0`
---
An MP3 string format.
`null`
---
An ISO-8601 string format.
`undefined`
#### --answer--
A UTC string format.
`NaN`
### --question--
@ -422,7 +417,7 @@ If we are in the month of October, what will `console.log(new Date().getMonth())
#### --text--
Which option will output `"2021"` for the following object?
Which option will output `2021` for the following object?
```js
const d = new Date("2021-12-25");
@ -469,4 +464,3 @@ const d = new Date("2021-12-25");
#### --answer--
`console.log(d.toISOString())`