1. <script>
    2. var arr=[{price:4,count:2},{price:5,count:3},{price:7,count:2}];
    3. function sum(arr){
    4. var total=0;
    5. arr.forEach(item=>{
    6. total=item['price']*item['count']+total
    7. })
    8. return total;
    9. }
    10. console.log(sum(arr)) //37
    11. </script>