java script (variables)
Hello friends
Welcome to next blog about to java script.. In this blog we discuss about java operators.
first we learn how to assign value to variables.use "=" for assign values
var x = 5;
var y = 2;
var y = 2;
Add operation
use this operation to add values.
y=x+z
*
)
use this for multiplies numbers
z=x*y
Divide operator( / )
use this for divide numbers
z=x/y
Some other operations
" - " => Subtraction
" ** " => Exponentiation
" % " => Modulus
"++" => Increment
"--" => Decrements
Assignment Operators
=, +=, -=, *=, /=, %=, **=
+ operator also use to add (concatenate) strings
var txt1 = "saman";
var txt2 = "perera";
var txt3 = txt1 + " " + txt2;
var txt2 = "perera";
var txt3 = txt1 + " " + txt2;
Comparison Operators
== => equal to
=== => equal value and type
!= not equal
> =>grater than
< => less than
? ternary operator
see you in next blog
thank you
Comments
Post a Comment