How to compare 3 values Javascript

 

Compare 3 Values in JavaScript

 

To compare 3 values, use the AND (&&) logical operator to chain multiple conditions. When using the AND (&&) logical operator, all conditions must return true for the if block to execute.


 

const g = 10;
const h = 10;
const f = 10;

if(g === h && g === f)
{
//do something
}

Tags:

Share:

Related posts