Logical AND (&&) Operator in JavaScript

 The logical AND operator is used to check if multiple conditions are true.

Example:


let temperature = 30;

let humidity = 60;


if (temperature > 25 && humidity > 50) {

    console.log("It's hot and humid.");

} else {

    console.log("The weather is mild.");

}

Explanation:


The condition checks if both temperature is greater than 25 and humidity is greater than 50.

If both conditions are true, it prints "It's hot and humid."


No comments:

Post a Comment

SQL Server — Core Concepts with examples

  Data Definition Language (DDL) : CREATE , ALTER , DROP (tables, views, procedures, triggers). Data Manipulation Language (DML) : SELECT ,...

Best for you