They are "native" because they come with an ECMAScript implementation. The host environment is usually an application that consists of an implementation of ECMAScript and several other interfaces that work together. For instance,
- A web browser is a host environment consisting of an implementation of ECMAScript, a DOM interface, a rendering engine, a user interface, etc.
- Windows Script Host - a host environment consisting of an ECMAScript implementation, a VBScript implementation, etc.
- Node.js - a host environment consisting of an implementation of ECMAScript (V8), HTTP interfaces, etc.
Inline objects are required to inherit from Object or Function , whereas host objects — objects provided by the host environment but not necessarily present at the start of execution — are not required, but they can (and sometimes do).
Examples of native objects defined by ECMA-262
Object() , Array() , Date()Math , JSON , a Global object.
Examples of built-in embedded objects not defined by ECMA-262
Examples of host objects
- DOM objects,
document and window console
source share