Jump to content

Array[1]=Function()


Drycodez

Recommended Posts

There's usually not a reason. The main way people use functions like that is to assign them to objects and make them methods:

var obj = {  a: 'some value',  b: 10,  func1: function()  {    alert(this.a);  }};obj.func1();

The only time you would really put functions in an array is if you need to call multiple functions and you loop through the array to call each one, like a series of event handlers or something.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...