So I was able to "add" up all the string numbers but since they are string they just appear in the console side-by-side and obviously I can't actually add them up. How do I go about making them a number within my existing code?
let myStuff = [
{
"my_game":"PS4",
"worth":"25.30"
},
{
"my_cards":"pokemon",
"worth":"10.50"
},
]
const totalProfit = myStuff.reduce((cTotal, stuff) => {
return stuff.worth + cTotal
}, 0);
console.log(totalProfit)
I just get this: 25.3010.50 but it should add all of the worth which would equate to 35.80
Tried looking around and tried .map(Number) to convert it but nothing works.