Greg
0
Q:

not operator js

let a = true;

let b = !a;

console.log(b); //output: false
1
let a = 1;
let b = -1;

if (a > 0 & b > 0){
	console.log("and");
} else if (a > 0 || b > 0){
	console.log("or");
} 
0
a1 = true  && true       // t && t returns true
a2 = true  && false      // t && f returns false
a3 = false && true       // f && t returns false
a4 = false && (3 == 4)   // f && f returns false
a5 = 'Cat' && 'Dog'      // t && t returns "Dog"
a6 = false && 'Cat'      // f && t returns false
a7 = 'Cat' && false      // t && f returns false
a8 = ''    && false      // f && f returns ""
a9 = false && ''         // f && f returns false
1

New to Communities?

Join the community