JavaScript + - * / % **

Beginner
5 min read
Updated: Nov 2026
3 examples

Definition and Usage

Arithmetic operators compute numbers: +, -, *, /, % (remainder), and ** (exponent). + also concatenates when a string is involved.

JavaScript Syntax

JavaScript
console.log(2 + 3);
console.log(10 % 4);
console.log(2 ** 3);
console.log("2" + 3);
Try it Editor

How It Works

  1. Math. 2+3 is 5; remainder 2; power 8.
  2. String +. Concatenation when either side is a string.

Examples

Example 1 — Division by zero

Yields Infinity, not an exception.

JavaScript
console.log(1 / 0);
Try it Editor

How It Works

  1. IEEE floating-point rules.

Example 2 — ++ and --

Increment operators.

JavaScript
let n = 1; console.log(++n);
Try it Editor

How It Works

  1. Prefix ++ returns the new value.

Example 3 — Unary plus

Convert strings to numbers.

JavaScript
console.log(+"42");
Try it Editor

How It Works

  1. +"42" becomes number 42.

Frequently Asked Questions

Remainder after division (not always the same as mathematical modulo for negatives).

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful