Course contentsShow
← JavaScript
Lesson 235 of 2,7237. Arithmetic and OperatorsFree lesson

Multiplication and Division Operators

Understand * and / for multiplication and division, and how JavaScript handles decimal results.

Multiplication and Division Operators

You'll learn how to perform multiplication and division in JavaScript and understand how the language handles decimal results.

The Core Operators

JavaScript uses * for multiplication and / for division, just like a calculator. These operators work with any numeric values and always return a number:

let product = 5 * 3;      // 15
let quotient = 20 / 4;    // 5
let doubled = 7 * 2;      // 14
let halved = 10 / 2;      // 5

Decimal Results

Unlike some programming languages, JavaScript doesn't have separate "integer division" — division always returns the exact mathematical result, including decimals:

let result = 10 / 3;      // 3.3333333333333335
let half = 7 / 2;         // 3.5
let precise = 1 / 8;      // 0.125

If you need a whole number, you'll use methods like Math.floor(), Math.ceil(), or Math.round() that you've already learned.

Zero and Division

Multiplying by zero gives zero. Dividing by zero doesn't crash — it produces special values:

let zero = 5 * 0;         // 0
let infinity = 10 / 0;    // Infinity
let negative = -10 / 0;   // -Infinity
let invalid = 0 / 0;      // NaN

Operator Precedence

Multiplication and division happen before addition and subtraction:

let answer = 2 + 3 * 4;   // 14, not 20
let correct = (2 + 3) * 4; // 20 with parentheses

Key Takeaway: Use * for multiplication and / for division; JavaScript always returns precise decimal results, so use rounding methods when you need whole numbers.