and or condition in javascript code example
Example 1: js logical operators
Javascript Logical Operators
&& Logical and
|| Logical or
! Logical not
Example 2: javascript if and statement
let a = 1;
let b = 2;
if(a == 1 && b ==2){
// Code here
}
Example 3: javascript if or
let A = 1;
let B = 0;
if (A == 1 || B == 1){
// some code here
}
Example 4: js !==
var x = 5;
// === equal value and equal type
// e.g. 1.
x === 5 returns true
// e.g. 2.
x === "5" returns false
// !== not equal value or not equal type
// e.g. 1.
x !== 5 returns false
// e.g. 2.
x !== "5" returns true
// e.g. 3.
x !== 8 returns true