Free web development/design tutorials

Create a Website

HTML

Dreamweaver

CSS Tutorial

JavaScript

FREE Hosting!

With every domain name

you register at DotEasy

you get FREE (**no-ad**)

one year hosting.

With every domain name

you register at DotEasy

you get FREE (

one year hosting.

PLUS you get:

- FREE Website Builder
- FREE Blog
- FREE Forum
- FREE Photo Album
- FREE Email Accounts

Home > JavaScript Tutorial

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

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.

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

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

Operatiors | Description |

+ | Addition |

- | Subtraction |

* | Multiplication |

/ | Division |

% | Modulus (remainder of a division) |

++ | Increment |

-- | Decrement |

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

Operatiors | Description |

= | 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. |

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

Operatiors | Description |

= | Assign |

+ | Concatenate (join two strings together) |

+= | Concatenate and assign |