JS Advanced---Local objects, built-in objects, host objects

Source: Internet
Author: User
Tags hosting

Noun reference:
Native objects: Also called internal objects, local objects, native object
Built-in objects: Build-in object
Host objects: Host Object


ECMA-262 definition :
Native object: The object provided by the ECMAScript implementation independent of the hosting environment. It has nothing to do with the host, such as JavaScript (Vision Explorer), Nodejs (node platform), JScript (IE), typescript (Microsoft platform), and so on. In simple terms, a local object is a class defined by ECMA-262 (reference type). Objects that are created dynamically during the run process require a new
Built-in objects: all objects that are provided by the ECMAScript implementation, independent of the hosting environment, appear when the ECMAScript program starts executing, which is the object that was created during the engine initialization phase. This means that the developer does not have to instantiate the built-in object explicitly, it has been instantiated
Host object: The object provided by the hosting environment implemented by ECMAScript, consisting of two main classes, one for the host, one for the custom class, and ECMAScript for the host object, all non-local objects are host objects. The host provides the object principle---> The object that is registered by the host framework with a mechanism in the Ecscript engine, such as the host browser (as a vision reference), injects the window object into the Ecscript, building its implementation JavaScript.


Content
Native objects: Object, Function, Array, String, Boolean, number, Date, REGEXP, Error, Evalerror, Rangeerror, Referenceerror, SyntaxError, TypeError, Urierror
Built-in Objects: Globals (Global object), Math
Host object:----> The Window object in the browser and all of its sub-objects (such as the BOM, Dom, and so on), in node is GLOBLA and its child objects, also contains the custom class object.
Other objects: Global Object---> is one of the built-in objects. Custom Object---> It belongs to the host object

The relationship between them
Local objects and built-in objects: native contains built-in, built-in is a subset of native.
Host object: The global of the built-in object, which is the top-level object of the host, such as window in the browser, global in Nodejs


Special Note:
Global of built-in objects
Global is the World object, and the global object is the most special object in ECMAScript because it doesn't exist at all!
In ECMAScript, there is no independent function, and all functions must be methods of an object.
Similar to the isNaN (), parseint (), and parsefloat () methods, and so on, all appear to be functions, and in fact, they are all methods of the global object.
And the global object's approach is more than that. Specific reference http://www.w3school.com.cn/jsref/jsref_obj_global.asp

And based on my inconclusive inference, the global object is related to the host and is the top-level object of the host. For example, in JavaScript, the Global object is the Window object, and the following code tests the

<script>    var str= ' Hello ';     // function to invoke the built-in object with the host object     Console.log (Window.isnan (str)) </script>

It can be predicted that when the host is Nodejs, Nodejs's top-level object is global, so it certainly won't error--global.isnan (str)

Expansion method Content
No matter what the object, can be extended through the prototype function.

JS Advanced---Local objects, built-in objects, host objects

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.