(i). Global Object
All the properties and functions defined in the global scope are properties of global objects. such as isNaN (), Isfinite (), parseint (), and parsefloat () are actually all methods of the global object.
1. URI encoding Method encodeURI () and encodeURIComponent ()
A valid URI cannot contain certain characters, such as spaces. And these two URI encoding methods can encode the URI, they replace all invalid characters with special UTF-8 encoding, so that the browser can accept and understand.
var uri = "Http://www.baidu.com.cn/illegal value.htm#start"; alert (encodeURI (URI)); // Http://www.baidu.com.cn/illegal%20value.htm#start // Http%3a%2f%2fwww.baidu.com.cn%2fillegal%20value.htm%23start
encodeURI ()---decodeuri ()
encodeURIComponent ()---decodeuricomponent ()
2. Eval () method
The eval () method is like a complete ECMAScript parser that accepts only one parameter.
// Hi var msg = "Hello World"//HelloWorldeval ("function Sayhi () {alert (' Hello world! ')} " //Hello world!; eval ("var msg1 = ' Hello word ';" //Hello World
Any variables or functions created in eval () will not be promoted.
3. Window Object
ECMAScript Although it does not indicate how to access the global object directly, the Web browser implements the global object as part of the Window object. Therefore, all variables and functions declared in the global scope become properties of the Window object.
(ii) Math object
JavaScript Learning Notes (vi)----built-in objects