普通的for循环:
for (let i = 0; i < this.items.length; i++) {
totalPrice += (this.items[i].price) * (this.items[i].count);
}
for in 循环,通过索引去拿到值
for (let i in this.items) {
totalPrice += (this.items[i].price) * (this.items[i].count);
}
for of 循环,直接取到数组里面的对象
for (let item of this.items) {
totalPrice += item.price * item.count;
}