Skip to main content

JavaScript Operators

JavaScript Operators - Arithmetic & Logical is a core JavaScript concept covering learn about JavaScript operators, including the important distinction This topic is essential for academic learning, board exam preparation, and developing optimized real-world code.

What are Arithmetic Operators?

Arithmetic operators are used to perform mathematical calculations like addition, subtraction, and multiplication. They are the most basic building blocks of programming logic.

OperatorOperationDescription
+AdditionAdds two values together
-SubtractionSubtracts the right value from the left value
*MultiplicationMultiplies two values
/DivisionDivides the left value by the right value
%ModulusReturns the remainder after division

Note: While the basic behavior is the same across languages, how they handle things like "Integer Division" (e.g., 5 / 2) can vary.

Assignment Operators

Assignment operators assign values to JavaScript variables.

OperatorExampleSame As
=x = 10x = 10
+=x += 5x = x + 5
-=x -= 5x = x - 5
*=x *= 5x = x * 5
**=x **= 5x = x ** 5

String Concatenation

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

let text1 = "Vishnu";
let text2 = "Digital";
let text3 = text1 + " " + text2; // "Vishnu Digital"

Comparison Operators (Important!)

In JavaScript, there is a big difference between == and ===.

  1. Loose Equality (==): Compares values after converting them to a common type (Type Coercion). 5 == "5" returns true.
  2. Strict Equality (===): Compares both value and type. 5 === "5" returns false (because Number is not String).
Always use Strict Equality

To avoid bugs caused by JavaScript's automatic type conversion, professional developers always use === and !== instead of == and !=.


← Back: Numbers & Math | Next: Module 3 - Control Flow →

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir