0

Hi could anyone could help me with this code?

I'm trying to do a discount for the code, but a don't know how this is the code: function main() { var prodID = "LDFK"; var price = parseInt(("1700"),10); var discount = parseInt(("15"),10); var prod1= new Product(prodID, price); console.log(prod1.prodID + " price: " + prod1.price); //haciendo un descuento prod1.changePrice(discount); console.log(prod1.prodID + " new price: " + prod1.price); } function Product(prodID, price) { this.prodID = prodID; this.price = price; //completa el método para hacer el descuento this.changePrice = function(prod1){ this.prod1 = prod1 ; } }; main(); Clue The first entry is the product ID, the second is the price before the discount, and the third is the discount percentage. So after the discount the new price will be 1700-(0.15*1700) = 1445 The thing is that I'm lost on how to do it, if somebody could give me some help it would be nice 👍

27th Dec 2022, 12:44 AM
Alan Restrepo
Alan Restrepo - avatar
2 Réponses
+ 4
For a better help you could save your code on Sololearns Playground and link here.
27th Dec 2022, 3:01 AM
JaScript
JaScript - avatar