How can we use **JavaScript arithmetic operations **to manipulate numbers?

Read on to discover new insights about these operations.

Most of us love Math, right? Well, maybe not everyone, but hey! Math is a fundamental part of our lives.

So, you probably won’t be shocked to hear that JavaScript has a bunch of useful math functions.

**What is arithmetic operations in JavaScript?**

**Arithmetic operations in JavaScript **involve performing mathematical calculations on numbers.

JavaScript arithmetic operations are the building blocks of any numerical computations in this language.

**What are the basic arithmetic operators?**

**Here are the basic arithmetic operators in JavaScript:**

**Addition (+)**

Addition in JavaScript is straightforward way to combine two or more numbers or to adds two numbers together.

**For example:**

** let ****SampleNumber **= 8 + 8;
console.log('Sum: ' + **SampleNumber **)

**Output:**

**Sum: 16**

**Subtraction (-)**

**Subtraction **helps you find the difference between two numbers. It **subtracts **one number from another.

**For example:**

** let ****SampleNumber **= 10 - 2;
console.log('Difference: ' + **SampleNumber **);

**Output:**

**2**

**Multiplication (*)**

**Multiplication **is used to calculate the product of two or more numbers. It **multiplies **two numbers together.

**For example:**

**let ****SampleNumber **= 8 * 8;
console.log('Product: ' + **SampleNumber **);

**Output:**

**64**

**Division (/)**

**Division **allows you to divide one number by another.

**For example:**

**let SampleNumber = 100 / 4;
console.log('Quotient: ' + SampleNumber);**

**Output:**

**Quotient: 25**

**Modulus (%)**

The **modulus operator **gives you the remainder when one number is divided by another. It returns the remainder of a division operation.

**For example:**

**let SampleNumber = 64 % 5;
console.log('Remainder: ' + SampleNumber); **

**Output:**

**4**

The output is 4 because when 64 is divided by 5, the remainder is 4.

**Increment (++)**

**Increases **a number by one. **For example:**

**let i = 15;
i++;
console.log('Increment: ' + i)**

**Output:**

**16**

**Decrement (–)**

**Decreases **a number by one. For example:

**i = 15;
i--;
console.log('Decrement: ' + i); **

**Output:**

**14**

**Exponentiation ()****

Raises a number to the power of another number.

**For example:**

**let power = 3 ** 3;
console.log('Exponentiation: ' + power);**

**Output:**

**27**

The output is 27 because 3 raised to the power of 3 equals 27.

**How to use arithmetic operations on variables in JavaScript?**

You can perform arithmetic operations on variables in JavaScript just like you would with numbers.

Here’s an example:

**// Declare and initialize variables
let a = 8;
let b = 8;
// Addition
let sum = a + b;
console.log('Sum: ' + sum); // Outputs: Sum: 16 ✅
// Subtraction
let difference = a - b;
console.log('Difference: ' + difference); // Outputs: Difference: 0 ****✅
**
// Multiplication
let product = a * b;
console.log('Product: ' + product); // Outputs: Product: 64 **✅
**
// Division
let quotient = a / b;
console.log('Quotient: ' + quotient); // Outputs: Quotient: 1 **✅
**
// Modulus (remainder of division)
let remainder = a % b;
console.log('Remainder: ' + remainder); // Outputs: Remainder: 0**✅
**

**Conclusion**

In conclusion, **arithmetic operations in JavaScript** are fundamental tools that allow us to perform mathematical calculations on numbers.

These operations include addition, subtraction, multiplication, division, modulus (remainder of division), increment, and decrement. We also explored the exponentiation operation, which raises a number to the power of another number.

We learned how to use these operations with both numbers and variables in JavaScript.

Whether you love math or not, understanding these operations is crucial when programming in JavaScript. They form the basis for more complex computations and algorithms.

We hope this article has provided you with enough information to understand the **JavaScript arithmetic operations**.

If you want to explore more JavaScript topics, check out the following articles:

- JavaScript setTimeout vs setInterval
- Check if number is integer in JavaScript
- Array equality JavaScript

**Thank you for reading Itsourcecoders** 😊.