April 21, 2009

0 How to Define a Function

The syntax for creating a function is:

function functionname(var1, var2,...,varX)
{
some code
}

var, var 2 are variables or values passed into the function.The (and the) defines the start and end of the function.

Note:A function with no parameters must include the parentheses () after the function name:

function functionname()
{
some code
}

Note:Do not forget about the importance of capitals in Javascript!. The word function must be written in lowercase letters, otherwise a Javascript error occurs@ Also not that you must call a function with the exact same capitals as in the function name.


0 comments:

Post a Comment

Blogger Themes

 
Powered by Blogger