Use the prototype property to add a new property to all objects of a given type:
The value of fred.salary will be:
The prototype property allows you to add new properties and methods to existing object types.
Note: Prototype is a global property which is available with almost all JavaScript objects.
Property | |||||
---|---|---|---|---|---|
prototype | Yes | Yes | Yes | Yes | Yes |
Return Value: | A reference to the String.prototype object |
---|---|
JavaScript Version: | 1.1 |