NextGen Knowledge Center

Functions

This example shows the basic syntax structure for the creation of functions in JavaScript:

function functionName (p1, p2, …, pN) {
      // Code to execute
      return someValue;
}

There are various ways to call a function [e.g., var x = myFunction ("ABC", 100, myVar);]. Parameters are optional and unlimited. The return statement is also optional.