1. Loop Syntax
for (var index=1; index<10; index=index+1) {
code code code;
}
2. Array Syntax
var arrayname = [data1, data2, data3, ...]
列表元素从0开始计数,元素类型任意
3. Loop & Array
var arr = ["a", "b", 1, 2, "c"];
for (var i=1; i<arr.length; i++) {
console.log(arr[i]);
}
4. While
while (condition) {
// do something!
}
do ... while ...
do (condition) {
// do something!
// remember to change the condition.
} while (condition);
(完)
While Syntax
while (condition) {
// do something!
}