Master JavaScript Operators Tutorialspoint A Comprehensive Guide

Bobby Jul 13, 2026

When diving into JavaScript, you'll inevitably come across operators. They're the building blocks of your code, enabling you to perform actions or computations with values. In this tutorial, we'll explore the various types of JavaScript operators, their functions, and how to use them effectively.

JavaScript Increment & Decrement Operators: Simplify Your Code 🔄
JavaScript Increment & Decrement Operators: Simplify Your Code 🔄

JavaScript supports several types of operators, each serving a unique purpose. Let's break down these operators into categories and dig deeper into each.

JavaScript Operators.
JavaScript Operators.

Arithmetic Operators

Arithmetic operators are used to perform mathematical operations. They include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). Let's explore these with examples.

Operators
Operators

Here's a basic example of each:

Operator Example Result
+ var a = 10; var b = 5; var c = a + b; c = 15
- var a = 10; var b = 5; var c = a - b; c = 5
* var a = 10; var b = 5; var c = a * b; c = 50
/ var a = 10; var b = 5; var c = a / b; c = 2
% var a = 10; var b = 3; var c = a % b; c = 1 (remainder of 10 divided by 3)
a white board with yellow text on it that says,'javaserpt operators operators are symbols used to perform operations
a white board with yellow text on it that says,'javaserpt operators operators are symbols used to perform operations

Infix and Postfix Operators

JavaScript also supports infix and postfix operators for increment (++) and decrement (--). Here's how they work:

Infix: var a = 10; a++; (a now equals 11)

JavaScript operators | part 3 | Comparison operators and Logical operators 📖🚀
JavaScript operators | part 3 | Comparison operators and Logical operators 📖🚀

Postfix: var a = 10; var b = a++; (b equals 10, a now equals 11)

Assignment Operators

Assignment operators assign values to variables. The basic assignment operator is =, but JavaScript also offers shorthand operators like +=, -=, *=, /=, and %=, which perform an operation and assign the result to the variable in one step.

JavaScript Assignment Operators: Simplify Your Code Efficiently ✅
JavaScript Assignment Operators: Simplify Your Code Efficiently ✅

For example, var a = 10; a += 5; makes a equal to 15.

AND, OR, and NOT Operators

JavaScript Operators | Simply explained 🚀
JavaScript Operators | Simply explained 🚀
Comparison operators in JavaScript
Comparison operators in JavaScript
an info sheet with different types of programming
an info sheet with different types of programming
JavaScript Full Notes Every Beginner Must Save 💡
JavaScript Full Notes Every Beginner Must Save 💡
JavaScript Operators | part 2 | Simply explained Arithmetic operators and Assignment operators 📖 🚀
JavaScript Operators | part 2 | Simply explained Arithmetic operators and Assignment operators 📖 🚀
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
JavaScript Cheatsheet for Beginners | Learn JS Fast (One-Page Guide)
a piece of paper with different types of symbols and numbers on it that are written in spanish
a piece of paper with different types of symbols and numbers on it that are written in spanish
🚀 JavaScript Cheat Sheet for Beginners & Intermediate Developers | Quick Reference Guide
🚀 JavaScript Cheat Sheet for Beginners & Intermediate Developers | Quick Reference Guide
JavaScript Operators | part 4 | Unary Operator 📚 🚀
JavaScript Operators | part 4 | Unary Operator 📚 🚀
Functions in Javascript
Functions in Javascript
the different types of operators are shown in this table listing information for each operator's operating
the different types of operators are shown in this table listing information for each operator's operating
The JavaScript Cheat Sheet Every Beginner Wishes They Had
The JavaScript Cheat Sheet Every Beginner Wishes They Had
Javascript String Methods
Javascript String Methods
Operators
Operators
List of Java Operators with Examples | Complete Guide for Beginners
List of Java Operators with Examples | Complete Guide for Beginners
Build - IN Function in JavaScript
Build - IN Function in JavaScript
Learn JavaScript in 30 Days
Learn JavaScript in 30 Days
3 Ways to Define Functions in JavaScript
3 Ways to Define Functions in JavaScript
JavaScript Arrow Functions: Write Shorter & Cleaner Code 🚀
JavaScript Arrow Functions: Write Shorter & Cleaner Code 🚀
A quick intro to Higher-Order Functions in JavaScript
A quick intro to Higher-Order Functions in JavaScript

Logic operators perform logical operations on boolean values (true or false). The AND operator (&&) returns true if both operands are true. The OR operator (||) returns true if either operand is true. The NOT operator (!) negates its operand.

var a = true; var b = false; var c = a && b; (c equals false), var d = a || b; (d equals true), var e = !a; (e equals false)

Comparison Operators

Comparison operators compare two values and return a boolean value (true or false). They are crucial for decision-making in your code.

Here they are: == (equal), != (not equal), === (strictly equal), !== (strictly not equal), > (greater than), < (less than), >= (greater than or equal), and <= (less than or equal).

Equality and Inequality Operators

The equality (==) and inequality (!=) operators compare values, while the strictly equal (===) and strictly not equal (!==) operators compare both values and types.

var a = 10; var b = "10"; var c = a == b; (c equals true), var d = a === b; (d equals false)

Ternary Operator

The ternary operator is a shorthand way of writing an if-else statement. It consists of three operands: a condition, a value to return if the condition is true, and a value to return if the condition is false.

var a = 10; var b = (a > 5) ? "greater than 5" : "less than or equal to 5";

JavaScript operators are powerful tools for manipulating data and making decisions in your code. Practice using them in various scenarios to become proficient. Now that you've learned about the different types of operators, you're ready to apply this knowledge to your JavaScript projects.