ECMAScript Object Types

In ECMAScript, not all objects are created equally.

Generally, there are three types of objects that can be created and used: local objects, built-in objects, and host objects.

Local objects

ECMA-262 defines local objects (native objects) as 'objects provided by the ECMAScript implementation that are independent of the host environment'. In simple terms, local objects are the classes (reference types) defined by ECMA-262. They include:

  • Object
  • Function
  • Array
  • String
  • Boolean
  • Number
  • Date
  • RegExp
  • Error
  • EvalError
  • RangeError
  • ReferenceError
  • SyntaxError
  • TypeError
  • URIError

Related Pages

Advanced JavaScript Tutorial:ECMAScript Reference Types

Advanced JavaScript Tutorial:ECMAScript Function Class

JavaScript Reference Manual:Array Object

JavaScript Reference Manual:Boolean Object

JavaScript Reference Manual:Date Object

JavaScript Reference Manual:Number Object

JavaScript Reference Manual:String Object

JavaScript Reference Manual:RegExp Object

Built-in Object

ECMA-262 defines built-in objects (built-in object) as 'all objects provided by ECMAScript implementation, independent of the host environment, which appear at the beginning of the execution of the ECMAScript program'. This means that developers do not need to explicitly instantiate built-in objects, as they are already instantiated. ECMA-262 only defines two built-in objects, namely Global and Math (they are also local objects, according to the definition, each built-in object is a local object).

Related Pages

JavaScript Reference Manual:Global Object

JavaScript Reference Manual:Math Object

Host Object

All non-local objects are host objects (host object), that is, objects provided by the host environment implemented by ECMAScript.

All BOM and DOM objects are host objects.

Related Pages

Advanced JavaScript Tutorial:Implementation of JavaScript

CodeW3C.com Reference Manual:JavaScript Reference Manual

CodeW3C.com Tutorial:HTML DOM Tutorial