For the technically inclined, objects have a prototype property. Instance properties and methods are attached to the prototype property of an object. As an illustration, assume that two new methods and two new properties are added to the String object. The instance property and method are added to the prototype property of the String object, whereas, the static property and method are added to the String object itself.
The following two declaration lines illustrate an instance property and an instance method:
The following two declaration lines illustrate a static property and a static method:
The following code fragment illustrates the differences in using these properties and methods.
// Begin an instance of a String object
var newStr = "an example string";
var instVal = newStr.newInstanceProperty;
// Use the static property and method directly
var statVal = String.newStaticProperty;