JavaScript authoritative design--javascript expressions with operators, statements (briefly study note six)

Source: Internet
Author: User
Tags tag name

1.delete is a unary operator used to delete object properties or elements.
var a={    x:1,    y:2}delete a.x;    // Delete x attribute "x" in a    //False;a object no longer exists x attribute alert (a.x)    // undefined, there's still something here .
just like:
var b=[1,2,3]; Delete b[0];b.length    //3; or 3, although the above has been removed b[0]
  2.void operatorvoid ignores the value of the operation, so use void to make the program more semantically useful when the operand is auxiliaryExample: 
   void 3    //undefined    void 3+5    //nan;void priority ratio + High     void (3+5)    //undefined
 as we have often seen here:
<a href= "javascript:void (0)" ></a>// or <a href= "Javascript:void 0" ></a >
This makes the <a> tag click without any reaction. It's just the shape of a hand. We are also familiar with this situation:
<a href= "#" ></a>
this refers to the page itself. generally used for anchor (anchor point) marker positioning . such as:
aa<br>aa<br>aa<br>aa<br>aa<a name= "BB ">BB</a><br>AA ... <br>aa<br>aa<a href= "#BB" > Positioning to bb</a>// can run directly to BB 
another way to do this is to scroll to the top:<a href= "Javascript:document.body.scrollIntoView ()" > enables the entire body area to be seen </a>  3. Comma (,) operator
 for (var i=0,j=10;i<j;i++,j--) {    Console (i+ "   " +j);}
  4.functionWhen defining a function, the code inside the function body is not executed, and when the function is calledthe new function object to be executed is associated.   5.for/in
 for  in Object)
explanation: In the for/in statement, the JavaScript parser evaluates the object expression first, and if the expression is null or the UNDEFINED,JAVASCRIPT interpreter skips the loop and executes the subsequent code. If the expression equals an original value, the original value is converted to its corresponding wrapper object. The properties of the object are then enumerated in turn to perform the loop. Then, before each loop, JavaScript calculates the value of the V expression and pays it a string.   6. Jump StatementsThe break statement is a jump to the end of a loop or other statement. (valid in loops and switch statements)The continue statement terminates the execution of this loop and begins the execution of the next loop. (valid in the loop)The return statement lets the interpreter jump out of the function body. (exists in the function body legally)  7. Label Statementsconsisting of identifiers and sweating:identifier:statementThe statement is defined by a label, which can be referenced anywhere in the program by a tag name. as follows:
Maten:while (i!=null)    {... continue Maten; // Skip to Next loop     ...}
 

JavaScript authoritative design--javascript expressions with operators, statements (briefly study note six)

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.