For/In 循环
JavaScript for/in 语句遍历对象的属性:
实例
var person = {fname:"Bill", lname:"Gates", age:62};
var text = "";
var x;
for (x in person) {
text += person[x];
}
亲自试一试
While 循环
我们将在下一章学习 while 循环和 do/while 循环。
For/In 循环
JavaScript for/in 语句遍历对象的属性:
实例
var person = {fname:"Bill", lname:"Gates", age:62};
var text = "";
var x;
for (x in person) {
text += person[x];
}
亲自试一试
While 循环
我们将在下一章学习 while 循环和 do/while 循环。