View Single Post
Old 08-15-2007, 03:46 AM   PM User | #9
felgall
Senior Coder

 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 2,275
Thanks: 0
Thanked 23 Times in 22 Posts
felgall will become famous soon enough
function(x){return function(){alert(x)};}(i)

That is the parameter being passed to the function that will substitute into the "x" argument within the function.

This is the format because it is an anonymous (unnamed) function. It is the equivalent of the following if we give the function a name of "func".

function func(x) {return function(){alert(x)};} // defines the function
func(i); // runs the function
__________________
Stephen
Helping others to solve their computer problem at http://www.felgall.com/
Web related ebooks and software - http://members.felgall.com/
Focus on Javascript - http://javascript.about.com/
felgall is offline   Reply With Quote