JS Basic Statement

Source: Internet
Author: User


1. Required conditions in the loop: initial value cyclic condition state change loop body
for (initial value loop condition State change)
{
Loop body
}

The use of the for (Var i=0;i<100;i++) {if (i%7==0| | i%10==7| | parseint (I/10) ==7)   parseint is written in the  case {alert (i);  

2. Three-step operator? :

var s= a==b? " Equal to ":" is not equal to ";

3. Concatenation of Strings +

var str1= "Hellow"; var str2= "table"; var s=str1+str2;confirm (s);  Output hellowtable

4. Forced manual conversion in special places
can only turn integers to decimals

var a= "2";p arseint (a), Var s= "3.2";p arsedouble (s);

5. Summary

1. Basic data type: String, Decimal, Integer, Date time, Boolean, etc. 2, variable: "var" definition variable: var A; all variable definitions are defined with Var, var is a generic mutable type.  3, type conversion: converted to integers: parseint (); Converted to decimal: parsefloat ();    Case 4, Operator: The operation symbol is basically the same as C #  The only difference is in   C # inside/representing the quotient of the value   and/representation in addition to including the decimal point math operator: +-*/% + +--; relational operator: = = =  >  >=  <  <=; logical operator:&&  | |  ! ; other operators: + = = *=/=%=?: 5, statements: divided into sequential, branching and looping statements. Branch: if () {}else{}       switch () {case:break;} loop: for (;;) {}  Popup: Alert ("Alert"), Cancel Fork confirm ("confirm"), OK to cancel fork prompt ("Please enter Number", "you enter AH"); input OK cancel fork

6. Page Layout Summary

Web Design Summary: 1: The Web design is too non-hierarchical sense, from the back to rush, next time you need to first the overall framework layout, and then the layout of each framework; finally add content; Just like the processing of branch statements, the processing is done from a large scope, processing, processing, and then doing a small scope;2. Details: Each statement is as complete as possible: for example, each div must have at least a length and a width of less than the default area of 0; If you need a background, you can set the background in Boby. Width must be set here (can set to 100%The length is considered to increase with the increase of content;3.style position different effects, mouse trigger when the effect can be in <Style><style>inside individual set of background test4. In the process of modification, if you mistakenly </div> delete the default is added after the <div></div> is included in the last <div>(pay special attention when using the stream)5. If a problem occurs when using the margin function alone, you can firstfloatagain to use;6. Font Settings 7. a:hover a:link a:visited a:activited {not limited to a-label other tags can also be used as a class tag as well as a parallel descendant filter. wer:hover{Backgro und-color:red;    }.wer{width:300px;    height:300px; Background-color: #33F;    Position:absolute;    top:100px; left:100px}

7. Practice the problem of playing the board with Sesame

var sum=0;  for var i=0;i<=32;i++) {  var si=1;       for var j=0; j<i; J + +)    // Note the  n-th square    {     si=si*2   }   sum of 2, starting from 0 + =Si}alert (0.00001*sum)
View Code
var t=0.00001; var sum;  for var i=1;i<=32; i++) {       if(i==1)    {     sum=t;    }     if (i>1)    {        T=2*t;        Sum+ =t;        }} Alert ("total weight" +sum);p rompt ("Prompt", "you enter Ah");
method Two: List the first month as a special case separately


JS Basic Statement

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.