home / experts / javascript / column80 |
|
Defining FunctionsThere are at least three different ways to define a function in JavaScript. The first one is the traditional one: Pass "first" to this function and see that you get the expected alert box.
The second way to define a function is the anonymous way. You define a function inline, without giving it a name: Pass "second" to this function and see that you get the expected alert box. Let's take another example. The method setRegisterA() is defined as follows:
Let's use it now. First, create a variable of class
And then store a new value in
The third way to define a function is by constructing it with the Pass "third" to this function and see that you get the expected alert box.
Next: How to define a method |
Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: March 26, 2001
Revised: March 26, 2001
URL: http://www.webreference.com/js/column80/3.html