JavaScript Operators

JavaScript includes operators as in other languages. An operator performs some operation on single or multiple operands (data value) and produces a result. For example 1 + 2, where + sign is an operator and 1 is left operand and 2 is right operand. + operator adds two numeric values and produces a result which is 3 in this case.

JavaScript includes following categories of operators.

  1. Arithmetic Operators
  2. Comparison Operators
  3. Logical Operators
  4. Assignment Operators
  5. Conditional Operators

JavaScript String Operators

The + operator can also be used to add (concatenate) strings.


var txt1 = "John";
var txt2 = "Doe";
var txt3 = txt1 + " " + txt2;

Example -

Example -