Javascript word form Operators

Source: Internet
Author: User

1. void operation expression and ignore its return value, such as void (1 + 2), void (0)

Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "content-type" charset = "UTF-8"/>
<Script type = "text/javascript">
Alert (typeof (void (0); // void (0) is calculated as 0. Because the returned value is ignored, the typeof type is undefined.
</Script>
</Head>
<Body>
1. Use the onclick event for flexible processing; 2. void (expression) <br>
<A href = "javascript: void (0);" onclick = "location. href = 'HTTP: // www.baidu.com ';"> Baidu </a>
<A href = "javascript: void (location. href = 'HTTP: // www.google.com ')"> Google </a>
</Body>
</Html>

2. typeof: Type of the returned variable or value, such as typeof (void 1 + 2) and typeof (void (1 + 2 ))

Given the operator priority, void 1 + 2 is calculated as follows:

3. new is used to create the object real column of the specified class.

4. delete to delete the real-column attribute. Note the following when deleting:

1. Only Delete the real column attribute, but not the object

Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "content-type" charset = "UTF-8"/>
<Script type = "text/javascript">
Var parent = {};
Var son = {age: 10 };
Parent. son = son;
Alert (parent. son. age); // 10
Delete parent. son;
Alert (parent. son); // undefined
Alert (son. age); // 10
</Script>
</Head>
<Body>
</Body>
</Html>

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.