A JavaScript function is a block of JavaScript code, that can be executed when "called" for. A function can be called when an event occurs, like when the user clicks a button. Scripts can be placed in the ❮body❯ or in the ❮head❯ selection of an HTML page, or in both. It can also be in an external style sheet. There are different ways for JavaScript to "display", this is a review:
One of the many JavaScript HTML methods is getElementById().
Javascript can change HTML content.
The document will get the date and time.
In this case JavaScript changes the value of the source attribute of an image.