Mastering JavaScript Arithmetic Operations

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:

Thank you for reading Itsourcecoders 😊.

Frequently Asked Questions

Is JavaScript still worth learning in 2026?
Yes. JavaScript runs on 98% of websites for the front-end, dominates the back-end via Node.js, powers mobile apps through React Native, builds desktop tools through Electron, and is the scripting layer for most AI tooling (LangChain.js, OpenAI SDK, Vercel AI). Whether you target web, mobile, AI, or full-stack capstones, JavaScript is the broadest single language you can learn.
What is the difference between var, let, and const?
var is function-scoped, hoisted to the top of its scope, and can be redeclared, which leads to bugs in modern code. let is block-scoped (only visible inside the nearest {}) and can be reassigned. const is block-scoped and cannot be reassigned, although object contents can still mutate. Default to const for everything, switch to let only when you actually need to reassign, and avoid var in any code written after 2017.
Which JavaScript version should I target in 2026?
Target ES2020 (ES11) as the safe baseline because every modern browser and Node.js 14+ supports it fully. ES2022 adds useful features like top-level await, private class fields with the # prefix, and the .at() array method. If you are writing for older browsers (IE11 or older Android WebViews), transpile down with Babel or use a build tool like Vite, esbuild, or webpack.
What is the best free editor for JavaScript?
Visual Studio Code is the industry standard, free, with built-in IntelliSense, debugger, terminal, Git, and a huge extension marketplace (ESLint, Prettier, GitHub Copilot, Tailwind). Install the JavaScript and TypeScript Nightly extension for the latest language features. JetBrains WebStorm is more powerful and free for students with a verified .edu email. For quick scratchpad work, the Chrome DevTools Sources panel includes a workspace and breakpoint debugger.
How do I run JavaScript locally vs in the browser?
In the browser: open DevTools with F12 (or right-click then Inspect), go to the Console tab, type or paste your code, press Enter. For HTML pages, add a script tag pointing to your .js file. Locally with Node.js: download Node from nodejs.org (LTS version), then run node script.js in your terminal from the file folder. Use the same Node setup for backend capstones, API integrations, and scripts that do not need a browser.
What can I build with JavaScript for my BSIT capstone?
Common BSIT capstones in JavaScript: full-stack web apps using React or Vue on the front-end with Node.js and Express on the back-end (MongoDB or MySQL for the database), real-time chat or notification systems using Socket.io, single-page dashboards with Chart.js or D3.js, cross-platform mobile apps with React Native, AI-powered chatbots using OpenAI SDK and LangChain.js, and Chrome extensions for productivity tools. Add Tailwind CSS for the UI and Vercel or Netlify for free deployment.

Caren Bautista


Technical Writer at PIES IT Solution

Responsible for crafting clear, well-structured, and beginner-friendly content across the platform. Handles the writing, proofreading, and editorial review of tutorials, guides, and documentation to ensure every article is accurate, readable, and easy to follow.

Expertise: Technical Writing · Content Creation · Documentation · Editorial Writing · JavaScript · TypeScript · Python · Python Errors · HTTP Errors · MS Excel
 · View all posts by Caren Bautista →

Leave a Comment