8 months ago|
Tech

Arithmetic Operators in JavaScript

Learn how to use arithmetic operators in JavaScript for basic mathematical operations like addition, subtraction, multiplication, division, and more. This guide includes simple explanations and code examples for beginners.

Editor

Author at Billianz

  • Jun 29, 2025
  • 5 min read
  • 14

Arithmetic Operators in JavaScript


Arithmetic operators are symbols used to perform mathematical calculations in JavaScript. These are essential for handling numbers, creating counters, doing calculations, and building logic in your programs.


➕Adds two numbers together.

let sum = 10 + 5;
console.log(sum); // Output: 15

➖ Subtraction (-)

Subtracts the second number from the first.

let difference = 10 - 3;
console.log(difference); // Output: 7

✖️ Multiplication (*)

Multiplies two numbers.

let product = 4 * 3;
console.log(product); // Output: 12

➗ Division (/)

Divides the first number by the second.

let result = 20 / 5;
console.log(result); // Output: 4

🧮 Modulus (%)

Returns the remainder when one number is divided by another.

let remainder = 10 % 3;
console.log(remainder); // Output: 1

Exponentiation (**)

Raises the first number to the power of the second.

let power = 2 ** 3;
console.log(power); // Output: 8

🔼 Increment (++)

Increases a number by 1.

let count = 5;
count++;
console.log(count); // Output: 6

🔽 Decrement (--)

Decreases a number by 1.

let count = 5;
count--;
console.log(count); // Output: 4

Conclusion

Arithmetic operators are one of the most commonly used tools in JavaScript. Whether you're doing basic math or building dynamic features, these operators are a key part of your programming toolkit. Practice using them in different scenarios to get comfortable with number-based logic.


No comments yet

Be the first to share your thoughts!

Your Views Please!

Your email address will not be published. Required fields are marked *

You may also like