Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function declaration question

Status
Not open for further replies.

MikeBronner

Programmer
May 9, 2001
756
US
I've been browsing some scripts on the net lately and have come across something I haven't seem before:
Code:
var [name] =
{
    [name] : function ([parameters])
    {
        [...]
    }
}

I'm at a loss as to how this works? is this a class immediately instantiated in a variable, with all its members declared as well?

Could you point me to a resource that discusses these methods (as in ways of programming, not as in functions)? My googling didn't reveal anything.

Thanks!

Take Care,
Mike
 
Douglas Crockford's reference here:


is well-referenced, as is this article at the Rochester Instirute of Technology:


I've used both before quite a few times. There are also JS frameworks around, such as the "Prototype" framework (not to be confused with the "prototype" keyword):


which lets you extend classed from others, and offers lots of easy binding methods, etc.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for your response on this topic! The link pointing to prototypejs.org is the one that helped me further. So basically this is nothing more than a collection of functions wrapped in a variable.

Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top