// demo-01
const items = ['a', 'b', 'c'];
for(const [i, item] of items.entries()) {
console.log(`${item} is the ${i} item`);
}
// demo-02
function addUpNumbers() {
let total = 0;
for(let num of arguments) {
total += num;
}
return total;
}
var res = addUpNumbers(1, 3, 5, 7, 9);
console.log(res);
网友评论