0

See this fiddle for a good example of a function object and the object that $() returns.

http://jsfiddle.net/tFhFD/3/

Reference:

http://code.jquery.com/jquery-latest.js

4

1 回答 1

3

No, that's not how you create a function object, that's how you create an object.

To create a function object, you just create a function. For example:

var function_object = function(){};

Or:

function F(){}
var function_object = F;

As a function is also an object, you can add properties to it just like any other object:

function_object.myProperty = 42;

function_object.doSomething = function(){};
于 2012-09-25T23:30:47.573 回答