ES6数组的新增高级方法
//filter 过滤器
//map 映射
//reduce 汇总
//筛选并计算大于等于10的数并打5折,然后求和
let goods = [30, 80, 50, 5, 3, 1, 60, 9];
let sum = goods.filter(n => n >= 10).map(n => n*0.5).reduce((s, n)=>s+n);
console.log(sum);
积累知识,创造财富
//filter 过滤器
//map 映射
//reduce 汇总
//筛选并计算大于等于10的数并打5折,然后求和
let goods = [30, 80, 50, 5, 3, 1, 60, 9];
let sum = goods.filter(n => n >= 10).map(n => n*0.5).reduce((s, n)=>s+n);
console.log(sum);