Question from the Javascript - Fundamentals test

Calculate the total price of a shopping list in Javascript

Easy

What does the following code do?

    const shopping = [
            { type: "pasta", price: 0.90 }, 
            { type: "pesto", price: 1.10 },
            { type: "gruyere", price: 3.25 },]; 
   const budget = shopping.reduce(function(acc, cur) { return acc + cur.price; }, 0); 
Author: KahinaStatus: Published(Update)Question passed 190 times
Edit
2
Community EvaluationsNo one has reviewed this question yet, be the first!