not equal operator javascript code example
Example 1: javascript does not equal
!= not equal
!== not equal value OR type
Example 2: javascript if not
var isDay = false;
if (!isDay) { //Will execute if isDay is false
console.log("It's night");
}
Example 3: not equal to in js
let a=12
if(a!=5){
console.log(true)
}
since a is not equal to 5, it will print true
Example 4: and operator in javascript
//&& returns true if both values are true
//or returns the second argument if the first is true
var a = true
var b = ""
var c = 1
true && "" //""
"" && 1 //""
false && 5 //false
Example 5: and operator in javascript
//& (bitwise AND) operator
console.log(5 & 13); //outout: 5
/*
5 = 0101 (base 2)
13 = 1101 (base 2)
//AND every bit together from both numbers
+----+
|0101|
|1101|
+----+
|0101|
+----+
0101 = 5 (base 10)
*/