//範例─輸出:
document.write( a + "<br>");
document.write( "a的值是:" + a + "<br>");
//範例─條件判斷:
if ( a > 3 ) {
document.write( a + "大於3。<br>");
}else{
document.write( a + "小於或等於3。<br>");
}
//範例─條件判斷(2層):
if ( a > 3 ) {
document.write( a + "大於3。<br>");
}else if ( a == 3){
document.write( a + "等於3。<br>");
}else{
document.write( a + "小於3。<br>");
}
//範例─迴圈:
for (var i=0 ; i < a ; i++ ) {
document.write( "第" + i + "次。<br>");
}