methods
- apply
-
Applies the method of another object.
Motorcycle.prototype = {
...
engine: new Motor(this.cc),
...
revEngine: function(rpms) {
//calls the increaseRpm method of the engine object
//and passes the Motorcycle object as the scope.
if (!this.engine.started) {
this.engine.start.call();
}
this.engine.increaseRpm.apply(this, rpms);
},
...
};
- call
-
Calls a method of another object.
Motorcycle.prototype = {
...
engine: new Motor(this.cc),
...
revEngine: function(rpms) {
//calls the increaseRpm method of the engine object
//and passes the Motorcycle object as the scope.
if (!this.engine.started) {
this.engine.start.call();
}
this.engine.increaseRpm.apply(this, rpms);
},
...
};
- object toSource()
-
Returns a literal representing the source code of the object e.g
"function Object() { [native code] }" or "function Car(manufactuer,
model, productionyear) { this.make = manufactuer; this.model = model;
this.year = productionyear; }".
- string toString()
-
Returns a string representing the object i.e. "[object Object]".
- void unwatch(property)
-
Removes a previously set watchpoint.
- object valueOf()
-
Returns the primitive value of the object e.g. "function Object() { [native code] }".
- void watch(property, handlingFunction)
-
Calls the handlingFunction when the property is changed.
properties
- constructor
-
The constructor method is the base method used to create an instance of the object.
- prototype
-
Exposes the prototype for the method or property of the object.