首页 > 其他 > 详细

for循环 es6

时间:2021-08-14 11:37:19      阅读:12      评论:0      收藏:0      [点我收藏+]

totalPrice: function() {
let result = 0
// 末尾都没有分号啥的 喵喵喵喵
for (let i = 0; i < this.books.length; i++) {
result += this.books[i].price
}
return result

                // for(let i in this.books){}   这是es6里面的语法
                // for(let book of this.books)   直接取出来是book
            }

for循环 es6

原文:https://www.cnblogs.com/icemiaomiao3/p/15140009.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!