Js定数と変数 3627 ワード JavaScript入門点滴 //1. : 、 、 、null…… document.write("<li>JavaScript ,tomy !"); document.write("<li>" + 3 + " !"); if(true) { document.write("<li>if :" + true); } document.write("<li> 011 :" + 011); document.write("<li> 0xf :" + 0xf); // : //var = ; // // = ; // //var js , ! // var //var ; //var str = "js , !"; // //var b = true; // //var n = 10; // //var obj = new Object(); // // var str = "tomy js!"; var b = true; var n = 10; var m; var o = new Object(); p = new Object(); document.write( "<hr>" + str + "<br>"); document.write( b + "<br>"); document.write( n + "<br>"); document.write( m + "<br>"); document.write( o + "<br>"); document.write( p + "<br>"); // alert(" "); str = " "; b = false; n = 20; m = 30; o = new Array("data1","data2"); //o document.write("<font color=red><br>"); document.write( "<hr>" + str + "<br>"); document.write( b + "<br>"); document.write( n + "<br>"); document.write( m + "<br><br>"); document.write( o + "<br>"); document.write( " o :" + o.length + "<br>"); document.write(p + "<br>"); document.write("<br></font>"); var pp; document.write(pp); var pp = 20;// , // : // , , // //name Name // , s, n…… //var sMyStr ="my string"; //var nIndex = 0; var nA = 10; var nB = 20; document.write("<hr> <br>"); document.write("<li>nA = " + nA); document.write("<li>nB = " + nB); var nTemp = nA; nA = nB; nB = nTemp; document.write("<br> <br>"); document.write("<li>nA = " + nA); document.write("<li>nB = " + nB); // // function func() { var nA = 999;// !: , var document.write("<li> nA:" + nA); } func(); document.write("<li> nA:" + nA); // var actorAry = new Array("cpu"," "," "); document.write("<hr> :"); for(n in actorAry) // { document.write("<li>" + actorAry[n]);// actorAry } 一つの小さなtoggg