alt
Advertisement
Online Training
Career Series
Exforsys
Exforsys arrow Tutorials arrow JavaScript arrow Passing values to JavaScript Function
Site Search


Passing values to JavaScript Function
Article Index
Passing values to JavaScript Function
Returning Values from Function

Passing values to JavaScript Function

In this JavaScript Tutorial you will learn about how to pass values to and also how to return values from a JavaScript function.

Passing Values to function:

Values can be passed to a function as parameters.

The general syntax for passing values to a function in JavaScript is:


function name_of_function(argument1,argument2,…argumentn)
{

…………………………………………
//Block of Code
…………………………………………

}

In the above argument1, argument2,...argumentn represents the values passed to the function.

For Example:

Suppose a programmer wants to create a function with name exforsys, which takes two values x and y.

These two values are passed from the calling program. Then function takes up the shape as follows:

 


function
exforsys(x,y)
{

…………………………………………
//Block of Code
…………………………………………

}

Suppose the values passed to the function from the calling program are 10 and 15.

Then, from the calling program the function is called as follows:


exforsys (10,15)



 
< Prev   Next >
Sponsored Links
© 2008 Exforsys.com
Joomla! is Free Software released under the GNU/GPL License.
Page copy protected against web site content infringement by Copyscape