Arithmetic Operators in Javascript

Ali Hasan
2 min readAug 8, 2022

--

#arithmeticoperators #alihasanhackerrank

JavaScript supports the following standard arithmetic operators:

Addition

Subtraction

Multiplication

Division

Modulus

Exponentiation

Increment

Decrement

Unary

Arithmetic Operators Syntax:

  1. Addition (+) a + b. The addition operator returns the sum of two values.
  2. Subtraction (-) a — b. The subtraction operator (-) subtracts one number from another.
  3. Multiplication (*) a * b. JavaScript uses the asterisk (*) to represent the multiplication operator.
  4. Division (/) a / b. Javascript uses the slash (/) character to represent the divide operator.
  5. Modulus (%) a % b. The modulus operator returns the remainder left over when a dividend is divided by a divisor.
  6. Exponentiation (**) a ** b. The exponentiation operator gives the result of raising the first operand to the power of the second operand.
  7. Increment (++) a++ or ++a. The increment operator increments (adds one to) its operand and returns a value.
  8. Decrement (–) a — or — a. The decrement operator decrements (subtracts one from) its operand and returns a value.
  9. Unary (-) -a. This is a unary operator i.e. it operates on a single operand. It gives the negation of an operand.
  10. Unary (+) +a. This is a way to convert a non-number into a number. Although unary negation (-) also can convert non-numbers, unary plus is the fastest and preferred way of converting something into a number, because it does not perform any other operations on the number.

In this challenge, we practice using arithmetic operators. Check out the attached tutorial for resources. Ali Hasan this channel provides all js solutions

--

--

Ali Hasan
Ali Hasan

No responses yet