How Space.com's Countdown Script Works
Space.com's countdown script (Figure 9-10) is a bit more complicated than the one on the Book of JavaScript website. However, aside from the calculations involved in determining the time until the next launch, it functions very similarly.
Figure 9-10. Space.com's countdown script
Line ❶ sets the date of the next space launch (as of the date I accessed this code; you'd see a different date if you selected View ▶ Source to look at the code now). Up until now, we've seen how to get the current date. Line ❶ shows you how to set the Date
object to a specific date. The number after 2005
is the time of the launch, where ...
Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.