contents   index   previous   next



Appendix B: Instance and Static Notation

 

 

ScriptEase uses object properties which are integral to JavaScript. For clarity we refer to object properties and object methods, not just properties, though both properties and methods may be referred to by the general term property. When using the terms property and method, object properties refer to the variables and data of an object and object methods refer to the functions of an object. We have clarified one dimension of object properties and methods. But, to be precise, we must deal with another dimension.

 

Object properties and methods are either instance, belonging to an instance of an object, or static, belonging to an object itself. Thus, all properties and methods of an object may be classified according to two dimensions. Is a property of an object a property or a method, and is it an instance or a static property? The following examples illustrate

 

Instance property string.length

Instance method string.indexOf()

Static property String.illus

Static method String.fromCharCode()

 

Objects may have all four categories of methods and properties, but usually they do not. In this illustration, the String object has three of the categories, but not a static property, which is the reason why String.illus had to be made up for this example.

 

ScriptEase documentation uses a couple of style conventions to distinguish between properties and methods and between being instance or static. The four sections, following the bullet list of explanations, illustrate how these distinctions are made in reference sections of documentation.

 

First, headings, such as "String instance properties" below, specifically identify whether the following reference information applies to instance properties, instance methods, static properties, or static methods.

Second, properties do not have parentheses "()" but methods do.

Third the top lines of reference tables vary in how they refer to instance and static properties and methods. Instance properties and methods have object names followed by a space, such as "String ", whereas static properties and methods have object names followed by a period, such as "String.".

Fourth, the syntax line for instance properties and methods uses the object name in all lowercase, whereas, the syntax line for static properties and methods uses the object name precisely. The significance is that instance properties and methods actually use the variable name of an instance of an object, whereas, static properties and methods use the actual object name itself.

Fifth, the use of lowercase for instance properties and methods is used consistently in text and descriptions, not just the reference tables themselves.


String instance properties sample

String instance methods sample

String static properties sample

String static methods sample

Prototype property