# Conditionals practice assingment: how do I use logical operator to compare prices?

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.')
}
``````

Yeah, so you have a bunch of chained else-ifs meaning that if any one condition is true, it will only execute the first one that is true. In addition, you set each if condition to be an OR condition, meaning that if either condition is true, then the whole thing is deemed true.

Aside from that, I would think about refactoring it such that you can check the graphics card price and monitor price independently to reduce the amount of checks. In order to do so, you’d have to change the logic somewhat.

For example, you could create a variable called resultString, add parts to the string based on the if-checks, then console.log the string once.

However, if you want to maintain your current structure, change the `||` to `&&` and it should work.

Succes!