JavaScript Code Problem
This is one of the SoloLearn JavaScript code challenges. The goal of the problem is given three inputs (product ID, price and discount), I need to display the current price and the new discounted price. I have accomplished the goal, but 1 out of 5 tests fail and it is consistently the 4th test. Unfortunately I cannot see the input, expected output and actual output, so I have no idea why. I have tried adding Math.round() to the code, but it produces the same results. I appreciate any and all help. Thank you! process.stdin.setEncoding('utf-8'); let inputString = ''; let currentLine = 0; process.stdin.on('data', inputStdin => { inputString += inputStdin; }); process.stdin.on('end', _ => { inputString = inputString.replace(/\s*$/, '') .split('\n') .map(str => str.replace(/\s*$/, '')); main(); }); function readLine() { return inputString[currentLine++]; } 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); //EVERYTHING ABOVE THIS WAS GIVEN IN THE PROBLEM AND IS UNCHANGED. My code is below 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 = price - (price * discount / 100); } };