javascript declare variable

1  <! DOCTYPE html > 
2  < html > 
3  < head > 
4      < meta charset = "utf-8" > 
5      < title > variable declaration </ title > 
6  </ head > 
7  < body > 
8  < script type = " text/javascript" > 
9      /* // 10     var sum
 in the javascript program   
 ; 11     //You can also declare multiple variables through the var keyword
 12     var i,sum;
   13      //You can also write the initial value of the variable and the variable declaration together
 14      var message="hello ";
 15      var i=0,j=0,k=0; //If the variable is not given in the var declaration statement Specify the initial value. Although this variable is declared, before storing a value in it, the initial value is undefined
 16       /**
 17  
18       *For and for/in loops can also use the var statement
 19  
20  
21       * */ 
22       
23  
24       for ( var i = 0 ;i < 10 ;i ++ )
 25           console.log(i);
 26       for ( var m = 0 ,j = 10 ;m<10;m++,j--)
27          console.log(m*j);
28    //
29 
30 
31 
32 </script>
33 </body>
34 </html>

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325136151&siteId=291194637