1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
You're creating a Date object for the first day of the first month of the year 2000. Fill in the blank. | let prevDate = new Date(______________); | "January 1, 2000" | •January1,2000• |
What is the keyword for extracting the basic time unit you need for calculating milliseconds? | getTime | getTime | |
Code a statement that creates a Date object for the last day of the last month of 2030 and assigns it to later, which hasn't been declared beforehand. | let later = new Date("December 31, 2030"); | letlater=newDate\(•December31,2030•\); | |
Code a statement that creates a Date object for 1 minute past midnight, New Year's Day, 2015, and assigns it to kissEnds, which has been declared beforehand. | kissEnds = new Date("January 1, 2015 00:01:00"); | kissEnds=newDate\(•January1,201500:01:00•\); | |
Create a Date object for the first second of the first day of the first month of 1901 and assign it to a variable that hasn't been declared beforehand. | let earlyTime = new Date("January 1, 1901 00:00:01"); | letearlyTime=newDate\(•January1,190100:00:01•\); | |
Code a single statement that displays in an alert the milliseconds that elapsed between the reference date and the beginning of 1980. | alert(new Date("January 1, 1980").getTime()); | alert\(newDate\(•January1,1980•\)\.getTime\(\)\); | |
Code a statement that converts the milliseconds represented by ticks to hours and assigns the result to a variable that hasn't been declared beforehand. Make up the variable name. | let hrs = ticks / 1000 / 60 / 60; | let[a-z_$][a-zA-Z0-9_$]*=ticks\/1000\/60\/60; | |
Code the first line of an if statement that tests whether the milliseconds represented by ms convert to more than 30 days. | if (ms / 1000 / 60 / 60 / 24 > 30) { | if\(ms\/1000\/60\/60\/24>30\){ | |
|
|||
|