let array1 = [];
            let array2 = [];
            array.forEach(e => {
                if (e.salary >= 3000 && e.salary <= 3500) array1.push(e);
            });
            console.log(array1);

            /* 定义*/
            function agetMethods(birthday) {
                return new Date().getFullYear() - birthday.substring(0, birthday.indexOf('.'));
                //console.log(new Date().getFullYear() -  birthday.substring(0, birthday.indexOf('.')));
            }

            function sumMethods(firstNumber, twoNumber) {
                return firstNumber + twoNumber;
            }

            array1.map(v => {
                if (agetMethods(v.birth) <= 19 && v.city != "湖南") {
                    v.age = agetMethods(v.birth);
                    array2.push(v);
                }
            });
            console.log(array2);

            let num = [];
            
            let count = 0;
            
            array2.filter(v => num.push(v.salary));
            
            num.filter(v => count = num.reduce(sumMethods));
            //总和
            console.log(count);

 

相关文章:

  • 2021-07-29
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-25
猜你喜欢
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案