QUESTION IMAGE
Question
jump to level 1
display the date when the world wide web was born in m/dd/yyyy format.
note:
- getmonth() gets the month number. months are numbered from 0 to 11. january is month 0.
- getdate() gets the day relative to the current set month.
- getfullyear() gets the 4 digit year.
ex: the 31st of january 1970 should be displayed as: \1/31/1970\.
1 let interestingevents = {
2 // reminder for month: 0 = jan, 1 = feb, 2 = mar, etc.
3 \long distance telegraph\: new date(1844, 4, 24),
4 \first telephone call\: new date(1876, 2, 10),
5 \microsoft founded\: new date(1975, 3, 4),
6 \world wide web born\: new date(1989, 2, 1),
7 \google founded\: new date(1998, 8, 4),
8 \facebook website launch\: new date(2004, 1, 4)
9 };
10 // code also tested using date of first telephone call
11 let interestingdate = interestingevents\world wide web born\;
12
13 / your solution goes here /
14
Step1: Get the month
The getMonth() function gives the month number (0 - 11). For "World Wide Web born" (new Date(1989, 2, 1)), interestingDate.getMonth() returns 2. But in the required M/DD/YYYY format (where month numbering starts from 1 in the output), we add 1. So the month is \(2 + 1=3\).
Step2: Get the day
The getDate() function gives the day. For "World Wide Web born", interestingDate.getDate() returns 1.
Step3: Get the year
The getFullYear() function gives the 4 - digit year. For "World Wide Web born", interestingDate.getFullYear() returns 1989.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
console.log((interestingDate.getMonth() + 1) + '/' + interestingDate.getDate() + '/' + interestingDate.getFullYear());