The date object part 3
Date Methods
When a Date object is created, a number of methods make it possible to perform operations on it.
For example:
Let's create a program that prints the current time to the browser once every second.
We declared a function printTime(), which gets the current time from the date object, and prints it to the screen.
We then called the function once every second, using the setInterval method.
The innerHTML property sets or returns the HTML content of an element.
In our case, we are changing the HTML content of our document's body. This overwrites the content every second, instead of printing it repeatedly to the screen.
Comments
Post a Comment