Summary of Objects in JavaScript

Summary of Objects in JavaScript

1.1 Overview
        Objects in JS can be divided into three types: "internal objects", "host objects" and "custom objects".
        Host environment: Generally, the host environment is created and maintained by the shell, as long as the environment that can provide the execution of the JS engine can be called the shell. Such as: web browsers, some desktop application systems, etc.
1.2 Object introduction
[b]1.2.1 Internal objects [/b]
        Internal objects include local objects and built-in objects.
        Native objects are objects provided by ECMAScript independent of the host environment, including Array, Boolean, Date, Function, Global, Math, Number, Object, RegExp, String, and various error class objects, including Error, EvalError, RangeError , ReferenceError, SyntaxError, and TypeError. Simply put, a local object is a class (reference type) defined by ECMAScript.
        Built-in objects are all objects provided by an ECMAScript implementation that are independent of the host environment and appear when an ECMAScript program starts executing. This means that the developer does not have to explicitly instantiate the built-in object, it is already instantiated. ECMAScript defines only two built-in objects, Global and Math (each built-in object is local by definition).
        The Global object is the most special object in ECMAScript, because in fact it doesn't exist at all, but in ECMAScript, there is no independent function, all functions must be methods of some object. Similar to isNaN(), parseInt(), and parseFloat() methods, etc., they seem to be functions, but in fact, they are all methods of the Global object. And the methods of the Global object don't stop there.
[b]1.2.2 Host Object [/b]
        The object provided by the host environment implemented by ECMAScript can be understood as: the object provided by the browser. All BOMs and DOMs are host objects.
Note: The host object provided by different browsers may be different, and even if the provided object is the same, its implementation is very different.
1.2.3 Custom Objects
        Developer-defined objects. JS allows the use of custom objects to expand JS applications and functions.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326119311&siteId=291194637