| Author |
functions in javascript
|
Naresh Chaurasia
Ranch Hand
Joined: May 18, 2005
Posts: 309
|
|
hi, i came across the following code in javascript..... how and when function like these called, since the above funcion does not have any name. thnx in advance
|
SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
|
 |
Pavan Keely
Ranch Hand
Joined: Jun 30, 2006
Posts: 62
|
|
Those are called anonymous functions. You can assign these function references to any variable. like, var myFunc = function() { //code here } and call that function like, myFunc(); If you don;t assign this function reference to any varible/object property, it's not much of use.
|
Pavan Keely<br /><a href="http://keelypavan.blogspot.com" target="_blank" rel="nofollow">http://keelypavan.blogspot.com</a>
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You normally do something like that as a JavaScript closures. Search Google for more information. Eric
|
 |
 |
|
|
subject: functions in javascript
|
|
|