Specifications

function min() { return this._min; }
function setMax( value ) { this._max = value; }
function setMin( value ) { this._min = value; }
}
typeof item
This operator returns a type of the object as a string.
typeof operator
Example:
var f = new Function("arguments[0]*2"); // "object"
var str = "text"; // "string"
var pi = Math.PI; // "number"
Functions and built-in objects have a "typeof" of "function".
Declarations
Classes, functions, variables and constants are declared with class, function, var and const
respectively.
Reserved words
JavaScript reserves some words which are valid identifiers for its own use:
Currently used for declarations: class, function, var and const.
Reserved for future use: boolean, byte, char, debugger, double, enum, export, float, goto,
implements, import, int, interface, long, native, short, synchronized, throws, transient and
volatile.
It is unadvisable to use any of these words as identifiers.
class
class ClassName {
static var ClassVariable;
var MemberVariable;
static function ClassFunction { Statements; }
function ClassName() { Statements; } // constructor
function MemberFunction() { Statements; }
}
This keyword is used to define new classes. After the keyword class comes the ClassName, then
optionally, the keyword extends followed by a class name from which this class derives, then
an opening brace. Class variables are declared with static var (ClassVariable). Only one instance
of these variables exists per class. Member variables (MemberVariable) are declared with var;
each instance (object) of the class has its own copy of each member variable. Functions declared
with the keywords static function are class functions (ClassFunction); these functions are called
using the name of the class rather than from an object. In the standard library, the Math functions
are all static, for example Math.sin(). Member functions are called by objects and are declared
with function. The constructor is the member function with the same name as the class;
constructors must not contain an explicit return statement or have an explicit return type, since
JavaScript handles these automatically.
A class that only contains static const, var and function definitions does not need a constructor.
398
Enfocus Switch 10