Hello,
As per my understanding regarding your query, I mentioned one example below with input value and it's output.
Ex:
const price = 100;
const quantity = 5;
const cost = price * quantity;
const discount = cost * 0.25;
console.log("Total Cost:", cost);
console.log("Discount:", discount);
console.log("Discounted Cost:", cost - discount);
Instead of
const discount = cost * 0.25; line of code you wrote
const discount = cost - (cost * 0.25); code.
I think this is the actual result you want i.e. "Amount after discount". But you took value in "const discount" variable. This will create confusion but the discount variable will carry the amount after the discount. If you want to check all separated(Total amount, discount, Amount after discount) then you can try my above written JS code.
Below is the output of my JS code:
Output:
Total Cost: 500
Discount: 125
Discounted Cost: 375
Let me correct if I am wrong to understand your question.