Logical Operators Bitwise Operators String Operators Miscellaneous Operators 1. JavaScript Arithmetic Operators We use arithmetic operators to perform arithmetic calculations like addition, subtraction, etc. For example, 5 - 3; // 2 Here, we used the - operator to subtract 3 from 5. Commonly Used ...
The following example demonstrates how arithmetic operators perform different tasks on operands. Example: Arithmetic Operation Copy let x = 5, y = 10; let z = x + y; //performs addition and returns 15 z = y - x; //performs subtraction and returns 5 z = x * y; //performs multiplicat...
JavaScript Arithmetic OperatorsArithmetic operators perform arithmetic on numbers (literals or variables).OperatorDescription + Addition - Subtraction * Multiplication ** Exponentiation (ES2016) / Division % Modulus (Remainder) ++ Increment -- Decrement...
String Operators Logical Operators Bitwise Operators Ternary Operators Type Operators JavaScript Arithmetic Operators Arithmetic Operatorsare used to perform arithmetic on numbers: Arithmetic Operators Example leta =3; letx = (100+50) * a; Try it Yourself » ...
Examples of Arithmetic Operators in JavaScript Now that you know all of the arithmetic operators supported in JavaScript, let us show an example of how each one works. Within each of these examples, we will explain further what the operator is used for and what math operation they perform. ...
Output: The simple table shows the Arithmetic Operators Do comment if you have any doubts on this JavaScript topic. Note:TheAll JS Examples codesare tested on the Firefox browser and the Chrome browser. OS:Windows 10 Code: HTML 5 Version...
JavaScript Arithmetic Operators - Learn about JavaScript arithmetic operators, their types, and how to use them effectively in your code for mathematical operations.
Arithmetic Special Operators In addition to four standard arithmetic operators (+, -, *, /), JavaScript provides the followingarithmetic operators. JavaScript Modulus operator (%) The modulus operator is used as follows: var1 % var2 The modulus operator returns the first operand modulo the second...
JavaScript Mathematical Operators The most obvious category of JavaScript Operators is mathematical operators. Mathematical operators, also called Javascript arithmetic operators, perform basic mathematical operations. Arithmetic operators take numeric literals, variables, or properties of existing objects as their...
Arithmetic operators perform basic computations on their operands (the variables they operate on). In the table below, variable a has a value of 2 before the operation is applied. OperatorOperationExpressionResult + Add 2 + a 4 - Substract 2 - a 0 * Multiply 3 * a 6 / Divide 3 / a...