Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Modify Object Properties

My code: Is it working as well ?

 function processSale(prod, quant){
var total = prod.inventory -= quant;
  var totSale = prod.unit_price * quant;

  console.log('we sold a total of ' + quant + ' ' + product.name);
  console.log('Totale Sale: ' +'$' + totSale );
}
processSale(product, 40);

1 Answer

Lee Vaughn
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Lee Vaughn
Treehouse Teacher

Hi Yannis,

Your code appears to be working just fine. It is logging the total of the product sold along with the total sale price as well as deducting the total sold from the inventory. Nicely done!

Were you having issues with your code or where you just asking because it differed slightly from what Dave came up with?