//for循环正序遍历
for (key in arr) { console.log(`Hello, ${arr[key]}!`); }
//for循环倒序遍历
for (i = arr.length - 1; i >= 0; i--) { console.log(`Hello, ${arr[i]}!`); }
//while循环正序遍历
var n = 0; do { console.log(`Hello, ${arr[n]}!`); n = n + 1; } while (n < 3)
//while循环倒序遍历
var n = arr.length - 1; do { console.log(`Hello, ${arr[n]}!`); n = n - 1; } while (n >= 0)
Sign in to make a reply
好汉饶命我善意第三人
//for循环正序遍历
//for循环倒序遍历
//while循环正序遍历
//while循环倒序遍历