Easy learning with example program codes

typescript assignment operators tutorial

TypeScript Assignment Operators:

TypeScript assignment operators are used to assign the values to the operands.

TypeScript Assignment Operators List:

=Assigna = 10 + 10; Result into a = 20
+=Add and assignvar a=10; a+=20; Result into a = 30
-=Subtract and assignvar a=20; a+=10; Result into a = 10
*=Multiply and assignvar a=10; a*=20; Result into a = 200
/=Divide and assignvar a=10; a/=2; Result into a = 5
%=Modulus and assignvar a=10; a%=2; Result into a = 0

TypeScript Assignment Operators Example:

var a:number = 20 
var b:number = 15  
a = b 
console.log("a = b: "+a)
a += b
console.log("a+=b: "+a)
a -= b 
console.log("a-=b: "+a)
a *= b 
console.log("a*=b: "+a)
a /= b 
console.log("a/=b: "+a)    
a %= b 
console.log("a%=b: "+a)


Please follow and like us:

Copyright © 2020 CodesJava Protection Status