The control flow is the order in which the computer executes statements in a script. Code is run in order from the first line in the file to the last line, unless the computer runs across the structures that change the control flow, such as conditionals and loops. Control flow means that when you read a script, you must not only read from start to finish but also look at program structure and how it affects order of execution.
A JavaScript function is defined with the
function
keyword, followed by a name, followed by parentheses()
, and can contain letters, digits, underscores, and dollar signs.
- When an event occurs (when a user clicks a button)
- When it is invoked (called) from JavaScript code
- Automatically (self invoked)
Function parameters are listed inside the parentheses () in the function definition.
Read and Demo
Skim
Resource Found