JS.10.2 Function Definition
The 'function' keyword introduces a new function in the global scope. Once a function is defined, it can be called in other parts of the script.
function sum(array1) {
var total = 0;
for(var idx = 0; idx < array1.length; idx++) {
total += array1[idx];
}
return total;
}
var total = sum(array2);
| << JS.10.1 Variable Definition | © 1996-2013 InetSoft Technology Corporation (v11.4) | JS.10.3 The 'if' Statement >> |