Learn JavaScript
Logical Operations


Sometimes we need to confirm multiple conditions are true before executing a block of code. In such cases, we can use AND &&.

In the example given above, if the student is from India and received an A grade, then the student gets a discount of 10%. Therefore to get the discount, both the conditions must be true.

Even if one condition does not evaluate to true, the student does not get any discount.

In the example given above, we change the value of stundentGrade to B, making the student ineligible for any discount.