When I Write This Code Give Me Error That:
Uncaught TypeError: Cannot read properties of undefined (reading ‘Price’).
My Code Is:
let Mahsol = [
{
id: 1,
Name: "Modem",
Price: 4200000
},
{
id: 2,
Name: "Adaptor",
Price: 1000000
},
{
id: 3,
Name: "Kabl",
Price: 120000
},
{
id: 4,
Name: "Rtx4050",
Price: 40200000
},
{
id: 5,
Name: "Rtx3070",
Price: 30000000
},
{
id: 6,
Name: "Rtx3060",
Price: 29000000
},
];
let Total = Mahsol.reduce((pre, pas) => {
return pre.Price;
});
console.log(Total)
i try it on console and it is okye and return me the price but then i use it to out of console give me error i expect to give me an price