-2
I need to sum up products and give 10% discount on the total value of products, follow the code below.
let produtos1 = 150.00
let produtos2 = 100.00
let produtos3 = 228.00
soma = produtos1 + produtos2 + produtos3
if (soma >= 200) {
console.log('voce acaba de ganha um desconto de 10%')
console.log('novo subtotal '+ desconto)
} else {
console.log('adicione mais produtos para ganha o desconto')
}
Let discount = sum-(sum*. 1);
– user60252
I know you already have a comment and an answer giving you the way, but I can’t help but comment: this is not a problem of programming, but of mathematics. I believe I could solve it on my own if I did an exercise on paper, not thinking about code, just mathematics. Take it as advice, if you can’t do this kind of math operation on your own, it’s gonna be hard to master programming logic.
– bfavaretto
is the pandemic that won’t let you go to math class
– user60252