HTML5 APPLICATIONS DEVELOPMENT MANUAL

(lu) #1

Definition and Execution of Functions


The way that a function is defined is different from how it is executed


by a browser.


A function’s definition outlines its name, any parameters it may take,


and its statements.


NOTE: a definition doesn’t perform any of a function’s statements.


The code inside the function will execute when "something" invokes (calls)


the function:



  • When an event occurs (when a user clicks a button)

  • When it is invoked (called) from JavaScript code Automatically (self


invoked)


When JavaScript reaches a return statement, the function will stop


executing.

Free download pdf