JavaScript for/in 语句循环遍历对象的属性:
var person={fname:"John",lname:"Doe",age:25}; for (x in person) { txt=txt + person[x]; }
下面do/while 循环
该循环至少会执行一次,即使条件是 false,隐藏代码块会在条件被测试前执行:
do { x=x + "The number is " + i + "<br>"; i++; } while (i<5);
JavaScript for/in 语句循环遍历对象的属性:
var person={fname:"John",lname:"Doe",age:25}; for (x in person) { txt=txt + person[x]; }
下面do/while 循环
该循环至少会执行一次,即使条件是 false,隐藏代码块会在条件被测试前执行:
do { x=x + "The number is " + i + "<br>"; i++; } while (i<5);