1//AND Operator expressed as &&
2
3const x = 7;
4const y = 4;
5
6(x == 7 && y == 5); // false
7(x == 3 && y == 4); // false
8(x == 7 && y == 4); // true
9
10if (condition == value && condition == otherValue) {
11 return something;
12}
1const num = 6;
2if (num <= 7 && num <= 8) {
3 console.log('true')
4} else {
5 console.log('false')
6}
7//Expected output:true
1// There are 3 Javascript Logical Operators
2// || (OR)
3// && (AND)
4// ! (NOT)
5
6if (a || b) {
7 console.log("I will run if either a or b are true");
8}
9
10if (a && b) {
11 console.log("I will run, if and only if a and b are both true");
12}
13
14if (!a) {
15 console.log("I will only run if a is false");
16}
17
18if (a) {
19 console.log("I will only run if a is true");
20}