Function to compute the product of p1 and p2
var p1 = { name: 'Apple', price: 1.0, quantity: 2 }; var p2 = { name: 'Banana', price: 2.5, quantity: 2 }; function computeProduct(p1, p2) { return p1.price * p1.quantity + p2.price * p2.quantity; } computeProduct(p1, p2);