April 25, 2005

Anonymous Functions

There is an ability within JavaScript to create a function on the fly. This doesn’t have to be a named, globally available function. It can be very ad hoc.

These are called Anonymous Functions.

function(txt){alert(txt);} ("I am the text message" );

That’s an unnamed function. It’s defined and executed immediately. If you have code that only needs to be executed once then you’ll want to use Anonymous Functions.

Post Info

Tagged As Javascript

Comments are Open (0)

Posted at 01:03 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Search
Comments on this post
Categories
Info
Tony Stephens
Copyright © 1995-2005
Site Version:
10
Licensed:
Creative Commons
Validate:
XHTML, CSS, 508, RSS
Subscribe
Blog-Fu, Link-Fu