JavaScript Loops

ITWeb/개발일반 2008. 2. 20. 16:28

 
JavaScript Loops
for
§for (var=startvalue;var<=endvalue;var=var+increment) {
§ code to be executed
§}
§for (variable in object) {
§ code to be executed
§}
while
§while (var<=endvalue) {
§ code to be executed
§}
§do {
§ code to be executed
§} while (var<=endvalue);

 
break / continue (break label / continue label)
§for (i=0;i<=10;i++) {
§ if (i==3) {
§ break;
§ }
§ document.write("The number is " + I + "<br />");
§}
§forLable : for (i=0;i<=10;i++) {
§ if (i==3) {
§ continue forLable;
§ }
§ document.write("The number is " + I + "<br />");
§}
 
with
§with ( document ) { // 반복 시킬 객체
§ write(생략된 객체 반복1<br>); // 구문
§ write(생략된 객체 반복2<br>); // 구문
§}
: