JavaScript Functions and Events
A JavaScript function is a block of JavaScript code, that can be executed when “called” for.

For example, a function can be called when an event occurs, like when the user clicks a button.

JavaScript inor
You can place any number of scripts in an HTML document.

Scripts can be placed in the, or in thesection of an HTML page, or in both.