


JavaScript Advanced Programming Reading Notes 11 Built-in Object Global_javascript Skills
Definition: All objects provided by the ECMAScript implementation that are independent of the host environment and appear when the ECMAScript program starts executing.
It can be seen from the definition that developers do not have to explicitly instantiate the built-in object, it has already been instantiated. Only two built-in objects are defined in ECMAScript-262, namely Global and Math
Global
The Global object is the most special object in ECMAScript, because in fact it does not exist at all.
Since there are no independent objects in ECMAScript, all functions must be methods of an object, such as the aforementioned isNaN(), isFinite(), parseInt() and parseFloat(), etc. Is a method of Global object.
Escape(), encodeURI(), encodeURIComponent(), unescape(), decodeURI(), decodeURIComponent(), eval(), etc. are all Global methods.
escape() && encodeURI() && encodeURIComponent()
These methods are used to encode strings.
There are 69 unencoded characters in escape: *, , -, ., /, @, _, 0-9, a-z, A-Z
There are 82 unencoded characters in encodeURI: !, #,$,&,',(,),*, ,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z
encodeURIComponent does not encode 71 characters: !, ', (,), *, -, ., _, ~, 0-9, a-z, A-Z
escape(): Not recommended, Deprecated
encodeURI(): Encode the URL, example:
encodeURI("http://www.jb51.net/a file with spaces.html")
// outputs http://www.jb51.net/a file with spaces.html
encodeURIComponent(): Encode parameters, example:
param1 = encodeURIComponent("http://xyz.com/?a=12&b=55")
url ="http://domain.com/?param1=" param1 "¶m2=99";
// outputs http://www.domain.com/?param1=http://xyz.com/�a=12&b=55¶m2=99
unescape() && decodeURI() && decodeURIComponent()
These methods are used to decode strings.
eval()
eval() may be the most powerful method in the ECMAScript language. This method is like the entire JavaScript interpreter, accepting one parameter, which is the function to be executed. ECMAScript (or JavaScript) string.
Example:
var msg="Hello world";
eval("alert(msg)");//alert "Hello world"
Note that the eval() function is very powerful, but it is also very dangerous. Especially when eval is used to execute user input, it may be injected by code.
All properties of Global object
Global not only has methods, it also has properties, all properties of Global object:
属性 |
说明 |
undefined |
Undifined类型的字面量 |
NaN |
非数的专用数值 |
Infinity |
无穷大值的专用数值 |
Object |
Object的构造函数 |
Array |
Array 的构造函数 |
Function |
Function 的构造函数 |
Boolean |
Boolean 的构造函数 |
String |
String 的构造函数 |
Number |
Number 的构造函数 |
Date |
Date 的构造函数 |
RegExp |
RegExp 的构造函数 |
Error |
Error 的构造函数 |
EvalError |
EvalError 的构造函数 |
RangeError |
RangeError 的构造函数 |
ReferenceError |
ReferenceError 的构造函数 |
SyntaxError |
SyntaxError 的构造函数 |
TypeError |
TypeError 的构造函数 |
URIError |
URIError 的构造函数 |
Source: http://artwl.cnblogs.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Master PHP built-in objects: Learn the operation and usage of commonly used built-in objects. Specific code examples are required. As a widely used back-end development language, PHP provides many powerful built-in objects that can help us develop and manage websites efficiently. Mastering the operation and usage of these built-in objects is crucial for PHP developers. This article will introduce some commonly used PHP built-in objects and provide specific code examples. 1. String processing object (String) String processing is often used in Web development, PHP

ASP built-in objects include Request, Response, Session, Application, Server, Session.Contents, Application.Contents, Server.CreateObject, Server.MapPath, Server.Execute, Server.Transfer, etc. Detailed introduction: 1. Request: represents HTTP request object, etc.

There are ten types of Python built-in objects: "int", "float", "str", "list", "tuple", "dict", "set", "bool", "NoneType" and "function": 1. int , used to represent integer values; 2. float, used to represent real values; 3. str, used to represent text data; 4. list, used to store a series of ordered elements; 5. tuple, tuple type; 6 , dict, a data structure used to store key-value pairs, etc.

Vue's built-in objects include Vue, Vue instance, data, el, options, parent, root, children, slots, scopedSlots, refs, isServer, attrs and listeners. Vue.js is a progressive JavaScript framework for building user interfaces. In Vue.js, there are some built-in objects or global APIs that can be used to create and manage Vue applications.

Nodejs built-in objects include Global, Process, Buffer, Console, Timer, EventEmitter, Stream, File System, HTTP, URL, Query String, Crypto, Path, OS, etc. Detailed introduction: 1. Global: global object, similar to the window object in the browser environment, which can be accessed anywhere; 2. Process, etc.

Xiaomi has introduced another WLAN mesh system for the global market. After the AC1200 router (approx. 69 euros on Amazon) went on sale in this country, the Xiaomi Mesh System AC1200 has now been announced. The new product has recently been listed on

JSP built-in objects refer to some predefined objects in JSP. Can be used directly in the page, these built-in objects provide many useful functions and properties, making it easier for developers to process and manipulate data. Common built-in objects in JSP include request object, response object, out object, session object, application object, config object, pageContext object, exception object, etc.

Built-in objects usually refer to objects with specific functions and properties provided by the programming language itself. These objects are usually part of the programming language and can be used directly in the code without additional import or loading. By using built-in objects, development Users can easily perform various operations, and these objects have the same behavior in different programs.
