Basic Operators

Operators are used to perform operations with variables and arbitary values. This page explains the function of each operator and their syntax.

• Arithmetic operators (+, -, *, /, %) - These are used to perform arithmetic with values stored either arbitarily or as variables. They can be performed by using their corresponding symbols as one would ordinarily do in pen-and-paper mathematics. They are addition (+), subtraction (-), multiplication (*), division (/) and modulus (%). Although other programming languages such as Microsoft Visual Basic and Visual C++ use the "Mod" keyword instead, JavaScript uses %, together with F#, among others.
• Equals sign (=) - These can be used to assign values or strings to variables or can be used in conjunction with arithmetic operators. The result is always on the right hand side of the "=" sign and the variable is always on the left. An example is illustrated below:
```var nineteen = 19;
var oneplusone = 1 + 1;
var sometext = "string";
```
• Comparisons (==, !==, >=, <=, >, <) - These are used to compare strings, numbers or other variables. They return a true/false value. An example is shown:
```var isthistrue = (5<9);
var isthisfalse = ("anyone"<"somebody");
```var a = (true || false); //true