 # Inverting logical expressions in JavaScript

Consider the following code:

```if (num > 0 && num < 5) { console.log('+++'); } else { console.log('---'); }```

Now our condition is following: `num` should be from `0` to `5`. Let's invert this condition, that is, turn it into its opposite. The opposite condition is: `num` must be less than or equal to `0` OR greater than or equal to `5`::

```if (num <= 0 || num >= 5) { console.log('+++'); } else { console.log('---'); }```

As you can see, in order to invert the condition, you have to think a little. It will be much easier to use the operator `!`, which is the logical `NOT`. Thanks to this operator, it is enough for us to put the sign `!` before the initial condition, then it inverts itself:

```if ( !(num > 0 && num < 5) ) { console.log('+++'); } else { console.log('---'); }```

Given the following code:

```if (num1 >= 0 || num2 <= 10) { console.log('+++'); } else { console.log('---'); }```

Using the operator `!` invert the above condition.