Create a Website
HTML
Dreamweaver
CSS Tutorial
JavaScript
FREE Domain!
Any web hosting you subscribe with DotEasy will get you a FREE domain name registration.
PLUS you get:
  • FREE Website Builder
  • FREE Blog
  • FREE Forum
  • FREE Photo Album
  • FREE Email Accounts
Get your FREE domain name today!
Home > JavaScript Tutorial
SSD Web Hosting with FREE Domain

JavaScript operators are used to perform an operation. There are different types of operators for different uses.

JavaScript Operators

The assignment operator = is used to assign values to JavaScript variables.

The assignment operator + is used to add values together.

Example

y=5;
z=2;
x=y+z;

The value of x, after the execution of the statements above is 7.

JavaScript Arithmetic Operators

Arithmetic operators are used to perform arithmetic between variables and/or values.

Given that y=5, the table below explains the arithmetic operators:

OperatiorsDescription
+Addition
-Subtraction
*Multiplication
/Division
%Modulus (remainder of a division)
++Increment
--Decrement

JavaScript Assignment Operators

Assignment operators are used to asign values to variables and/or values.

OperatiorsDescription
=Assign
+=Add and assign. For example, x+=y is the same as x=x+y.
-=Subtract and assign. For example, x-=y is the same as x=x-y.
*=Multiply and assign. For example, x*=y is the same as x=x*y.
/=Divide and assign. For example, x/=y is the same as x=x/y.
%=Modulus and assign. For example, x%=y is the same as x=x%y.

String Operators

In JavaScript, a string is simply a piece of text.

OperatiorsDescription
=Assign
+Concatenate (join two strings together)
+=Concatenate and assign

Enjoy this tutorial?

1. Link to this page(copy/paste into your own website or blog):
2. Add this page to your favorite social bookmarks sites:
3. Add this page as your favorites. (Press Ctrl+D)