0

Code coach error

Intermediate Java script Lesson 4 Code coach Its not moving, I am stuck, app still showing my code is wrong Or am I wrong I think app have some bugs function main() { var prodID = readLine(); var price = parseInt(readLine(),10); var discount = parseInt(readLine(),10); var prod1= new Product(prodID, price); console.log(prod1.prodID + " price: " + prod1.price); prod1.changePrice(discount); console.log(prod1.prodID + " new price: " + prod1.price); } function Product(prodID, price) { this.prodID = prodID; this.price = price; this.changePrice = function(discount) { this.price -= (this.price * discount) / 100; } }

13th Feb 2024, 1:09 PM
Rashid Rashi
Rashid Rashi - avatar
3 Respuestas
+ 2
Rashid Rashi, you need to add a closing curly brace for the changePrice method.
13th Feb 2024, 9:15 PM
Solo
Solo - avatar
0
Rashid Rashi , Please add a 'js' tag.
14th Feb 2024, 1:01 AM
Rain
Rain - avatar
0
int sum = 0; int num = 0; while (num<=4){ sum+= num; num++; } System.out.println(sum); } } Where is my mistake
15th Feb 2024, 6:50 AM
Karan Garg
Karan Garg - avatar