Extends the object with additional properties and methods.
Return value | Description |
---|---|
name | The name of the property or method. |
value | The value of the property or method. For a property, this should be an expression. For a method, this should be a function definition. |
Array.prototype.coname = ["Acme Corporation", "Chicago"];
Array.coname[0] + ", " + Array.coname[1]
Array.prototype.toProper = function() {
for(var i=0; i<this.length; i++) {
this[i] = this[i].left(1).toUpper() + this[i].substr(1).toLower();
}
return this;
}
var a = new Array("one", "two", "three", "four");
a.toProper() // [One, Two, Three, Four]