JavaScript | Operators - Part I

| Economics | January 21, 2026 | 804 views | 10:24

TL;DR

This tutorial covers JavaScript's fundamental arithmetic operators including addition, subtraction, multiplication, division, modulus, and exponentiation, with detailed explanations of increment/decrement prefix-postfix differences and operator precedence rules.

🔢 Core Arithmetic Operators 2 insights

Basic Math Operations

JavaScript uses standard symbols (+, -, *, /) for addition, subtraction, multiplication, and division exactly like mathematics.

Real-world Calculation Examples

The tutorial demonstrates adding prices (29.99 + 45.50 = 75.49) and calculating discounts by subtracting from original prices.

Specialized Mathematical Operators 2 insights

Exponentiation with Double Stars

The ** operator raises the first operand to the power of the second, such as 4 ** 2 resulting in 16 or 4 ** 3 yielding 64.

Modulus for Remainder Calculation

The % operator returns the division remainder, demonstrated by 5 % 2 producing 1 instead of the quotient.

🔄 Increment and Decrement Behaviors 3 insights

Simple Increment and Decrement

Using ++ adds one to a variable while -- subtracts one, turning x=20 into 21 and y=25 into 24.

Postfix Assignment Returns Original

When using x++, the original value (5) assigns to the new variable while x itself becomes 6 afterward.

Prefix Assignment Returns New Value

Using ++x increments the variable first, making both the original and assigned variables equal to 6 simultaneously.

⚖️ Operator Precedence Rules 2 insights

Multiplication Before Addition

JavaScript follows mathematical hierarchy where multiplication and division execute before addition and subtraction.

Complex Expression Evaluation

The expression 10 + 5 * 2 evaluates to 20 rather than 30 because multiplication occurs first due to higher precedence.

Bottom Line

Always remember that prefix (++x) returns the incremented value while postfix (x++) returns the original value, and multiplication/division operations execute before addition/subtraction in JavaScript calculations.

More from Company Man

View all
JavaScript | Operators - Part II
11:11
Company Man Company Man

JavaScript | Operators - Part II

This tutorial covers essential JavaScript operators including compound assignment shortcuts for cleaner code, the critical difference between loose and strict equality comparisons, and logical operators (AND, OR, NOT) for boolean logic.

2 months ago · 8 points
JavaScript | Data Types
10:22
Company Man Company Man

JavaScript | Data Types

This tutorial covers JavaScript's seven primitive data types—string, number, boolean, null, undefined, symbol, and BigInt—highlighting that JavaScript uses a single number type for all numeric values and emphasizing the critical distinction between null (intentional absence) and undefined (uninitialized variables).

2 months ago · 8 points
JavaScript | Variables
10:28
Company Man Company Man

JavaScript | Variables

This tutorial introduces JavaScript variables as named memory containers for storing and manipulating data, explaining the `var` keyword syntax, strict naming rules including case sensitivity and reserved keywords, and essential conventions like camelCase for writing readable, professional code.

2 months ago · 8 points

More in Economics

View all