So i wanna get the total of each object, but I only get undifined with this for each method.
what could go wrong?
var product = [
{"name":"Pie Susu","price":12000,"quantity":1},
{"name":"Kacang Bali","price":5000,"quantity":2},
{"name":"Pie Apel Susu","price":15000,"quantity":2}
]
the price * quantity
but i got undefined when use foreach.
what i tried.
var total = product.forEach( value => value.price * value.quantity);