Javascript Basic Operators And What's The Deal With The Unary Ones?

Renato Francia
9 min readOct 4, 2021
Photo by Dan Lohmar on Unsplash

Operators are one of the most important building blocks for creating software which is why it is a great idea to learn more about their behavior.

Here’s a brief description of what operators are:

An operator is a mathematical symbol which produces a result from one or two values. These operands are divided between binary and unary operators.

Sounds boring but it just means the following.

TLDR;

// Binary operators
a = 2; // Assignment Operator
a = 2 + 1; // Arithmetic Operator
2 < 3; // Relational Operators
true && false; // Binary Logical Operator
// Unary operators
!true // Logical NOT operator
a++ // Postfix Increment Operator
--b // Prefix Decrement Operator
~a // Bitwise NOT operator

Operators fall under the following categories:

  1. Assignment
  2. Comparison
  3. Arithmetic
  4. Bitwise
  5. Logical
  6. Comma
  7. Unary
  8. Relational

1) Assignment Operators:

--

--

Renato Francia
Renato Francia

Written by Renato Francia

Software Developer, Digital Nomad, Blogger and Tech Enthusiast.