Logical AND in JavaScript

You can group comparison operations using the && operator, which is a logical AND. In the following example, if the variable num is greater than zero and simultaneously is less than 10, only then '+++' will be displayed:

javascriptlet num = 3;

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

Conditions can be imposed not on one variable, but on different ones. In the following example, if the variable num1 is equal to 2 and simultaneously the variable num2 is equal to 3, only then the condition will be true:

javascriptlet num1 = 2;
let num2 = 3;

if (num1 == 2 && num2 == 3) {
  console.log('+++');
} else {
  console.log('---');
}
Задание 1

Check that the variable num is greater than zero and less than 5.

Задание 2

Check that the variable num is greater than or equal to 10 and less than or equal to 20.

Задание 3

Check that the variable num1 is equal to or less than 1 and the variable num2 is greater than or equal to 3.