Latest News

Arithmetic Operator,Java script arithmetic operator

Arithmetic operator: These operators perform arithmetic operations between two or more variables.
  • Addition (+) : document.write(a+b);
  • Subtraction (-) : document.write(a-b);
  • Multiplication (*) : document.write(a*b);
  • Division (/) : document.write(a/b);
  • Modulus (%) : document.write(a%b);
Addition Assignment operator: It is used to add new value to existing value.
Syntax  : var x=30;
x+=10;
document.write(x);
Output : 40
Subtraction Assignment Operator:  Subtract the new value from existing values.
Syntax : var x=30;
x-=10;
document.write(x);
Output: 10
Multiplication Assignment Operator: Multiply the new value in existing vale.
Syntax: var x=30;
x*=10;
document.write(x);
Output : 300
Division Assignment Operator: Divide the new value into existing value.
Syntax : var x=30;
x/=10;
document.write(x);
Output: 3
Modulus Assignment Operator:  It written remainder between existing value and new value.
Concatenation Operator(+): It is used to concat one number and one string data type or two string data types.
Syntax : var x=’30’;
var y=’20’;
document.write(x+y);
Output: 30 20

No comments:

Post a Comment

eWeb Classes Powered by MV Innovative InfoTech Copyright © 2014

Theme images by Bim. Powered by Blogger.