CodesJava

Easy learning with example program codes

Typescript logical operators tutorial


Typescript Logical Operators:

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

Typescript Logical Operators List:

Operator Description Example
&& Logical AND (20==40 && 20==30) = false
|| Logical OR (20==40 || 20==30) = false
! Logical Not !(20==30) = true

TypeScript Logical Operators Example:

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

Try it:

JS Bin on jsbin.com
 

Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki