function Car () / / definition of categories
(
var color = 'red'; / / private constructor can only be used in
this.color = color; / / public Object Properties
)
Car.prototype.run = function () / / definition of public method
(
alert (this.color);
)
javascript is an object inside, function is an object, the object attributes can be added on,
Under normal circumstances the need for a static variable or static function of the time there is a direct assignment to the function object, such as
var fn = function (){...}
fn.f1 = function (){...} / / static function
fn.a1 = "aaa"; / / static variables
fn.f1 (); / / call
fn.a1 = "bbb"; / / modify the value of







