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//&& returns true if both values are true
2//or returns the second argument if the first is true
3var a = true
4var b = ""
5var c = 1
6
7true && "" //""
8"" && 1 //""
9false && 5 //false
1//& (bitwise AND) operator
2console.log(5 & 13); //outout: 5
3/*
45 = 0101 (base 2)
513 = 1101 (base 2)
6//AND every bit together from both numbers
7+----+
8|0101|
9|1101|
10+----+
11|0101|
12+----+
130101 = 5 (base 10)
14*/
15
1// Javascript Airthmetic Operators
2+ : Addition
3- : Subtraction
4* : Multiplication
5** : Exponentiation (ES2016)
6/ : Division
7% : Modulus (Division Remainder)
8++ : Increment
9-- : Decrement