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 trialted Gadie
Full Stack JavaScript Techdegree Student 5,699 PointsHere is my Solution, am I any closer to what Dave is asking for ?
let product = {
name: 'camera',
inventory: 5,
unit_price: 690.99,
};
function addInventory(product , Add){
add = parseInt(Add);
product.inventory += add;
console.log(add + " " +product.name + "s added to the inventory." );
console.log(product.inventory +" "+ product.name + "s in the stock.");
}
addInventory(product,6);
function processSale(prod,Sold){
sold = parseInt(Sold);
prod.inventory -= sold;
console.log(sold +" "+ prod.name +" sold");
return sold * prod.unit_price;
}
console.log("Total Sale: " + processSale(product,2));
Jamie Reardon
Treehouse Project ReviewerIt's one of the JavaScript practices, I think it's the objects practice. Did this recently.
2 Answers
Steven Parker
231,172 PointsIt looks like you're referring to this video, and it has code in the "Teacher's Notes" that you can use to compare with your own.
At first glance, it looks like the main difference is that your functions perform "parseInt"s to convert strings into numbers, but that's not asked for in the instructions, and it's not the way they are used in the examples.
ted Gadie
Full Stack JavaScript Techdegree Student 5,699 Pointsthx
ted Gadie
Full Stack JavaScript Techdegree Student 5,699 PointsPath of the syntax above :
Unit 1 --> practice javaScript loops, Arrays, and Objects --> Practice Object Literals in JavaScript --> Modify Object Properties <---(Video)
Steven Parker
231,172 PointsSteven Parker
231,172 PointsWhat is it that "Dave is asking for"?
Please provide a link to the course page, and if it's a video also give an approximate time index.