I am following the javacript course and the assignment tells me to practice with conditionals.
I am trying the following. I want the code to let me know when a monitor and GPU are on sale.
When they are both on sale at my desired price.
When only the GPU is on sale.
When only the monitor is on sale.
When they are both on sale, but not my desired price.
And finally, when they are both not on sale.
It doesn’t seem to work like I want it to, it’s gives a truthy result back when one of the items are on sale, can anyone help me out here?
If I didn’t format my question right, I’d like to know as well, this is my first time doing this!
Many thanks!
if (graphicsCardPrice === 200 || monitorPrice === 100) {
console.log('Grafische kaart en monitor hebben mooie prijs!');
} else if (graphicsCardPrice > 300 || monitorPrice < 200) {
console.log('Monitor heeft korting, grafische kaart niet.')
} else if (graphicsCardPrice < 300 || monitorPrice > 200) {
console.log('Grafische kaart heeft korting, monitor niet.')
} else if (graphicsCardPrice < 300 || monitorPrice < 200) {
console.log('Grafische kaart en monitor hebben allebij korting.')
} else {
console.log('Grafische kaart en monitor hebben allebij geen korting.')
}