In this blog we can explore that Logical  Operators in Typescript .

Logical Operators :

Typescript logical operators are used to perform logical operations on the operands.

There are three logical operators as shown in the following:

Logical AND (&&) : The operator expression returns true if both expressions are true. 

An operator specifies a particular function that will be applied to the data. Operands are the data that operators manipulate.

Logical OR:If one of the two conditions is true, the compound expression returns true.

For the entire test to be true, at least one expression using the OR operator must be true.

Logical NOT : 

If either expression is inverted, the value returns true.

The expression’s result is changed to the opposite Boolean value by the NOT operator. As an illustration, the NOT operator returns false if an expression is true.

Example : 

var avg:number = 20;
var marks:number = 90;
console.log(“Value of avg: “+avg+” ,value of marks: “+marks);
var result:boolean = ((avg>50)&&(marks>80));
console.log(“(avg>50)&&(percentage>80): “,result);
var result:boolean = ((avg>50)||(marks>80));
console.log(“(avg>50)||(marks>80): “,result);
var result:boolean=!((avg>50)&&(marks>80));
console.log(“!((avg>50)&&(marks>80)): “,result);

For any Help or Queries Contact us on info@crmonce.com or +918096556344