Sid
0
Q:

or statment javscript

//The OR operator in Javascript is 2 verticals lines: ||

//Example
var booleanOne = true;
var booleanTwo = false;

if(booleanOne || booleanTwo) {
	//At least one boolean is true -> code excuted
}
11
if (x === 5 || x === 8)
  console.log("x is eaqual to 5 OR 8")
1
if (5 < 10) {
	console.log("5 is less than 10");
} else {
	console.log("5 is now bigger than 10")
}
6
let A = 1;
let B = 0;
if (A == 1 || B == 1){
  	// some code here
}
4
var hungry=true;
var slow=true;
var anxious=true;

//&& means and
if(hungry && slow && anxious){ 
	var cause="weed";
}
3

if (condition) {

  //  block of code to be executed if the condition is true

 }

 
5

if (hour < 18) {

    greeting = "Good day";

 } 
4
if(booleanOne && booleanTwo) {
	//Both booleanOne and booleanTwo are true here
}
-2

New to Communities?

Join the community