JavaScript Learning Notes (vi)----built-in objects

Source: Internet
Author: User

(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

Related Article

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.