js if not code example

Example 1: not operator js

let a = true;

let b = !a;

console.log(b); //output: false

Example 2: or statment javscript

if (x === 5 || x === 8)
  console.log("x is eaqual to 5 OR 8")

Example 3: != javascript

// " != " in Javasacript means : not equal.

Example 4: javascript if not

var isDay = false;
if (!isDay) { //Will execute if isDay is false
  console.log("It's night");
}

Example 5: equal to or more than javascript

//Equal to or more than
a >= b
//Equal to or less than
a <= b

Example 6: and javascript

let a = 1;
let b = -1;

if (a > 0 & b > 0){
	console.log("and");
} else if (a > 0 || b > 0){
	console.log("or");
}

Tags:

Html Example