Page 185 - Web Applications (803) Class 12
P. 185
Output of the preceding program is as follows:
3.3 JAVASCRIPT ARITHMETIC OPERATORS
The following are the arithmetic operators used to perform arithmetic on numbers in JavaScript:
Operator Description
+ Addition
- Subtraction
* Multiplication
** Exponent
/ Division
% Modulus (Division Remainder)
++ Increment (adding of 1)
++a (pre increment)—first increment then processing
a++ (post increment)—first processing then increment
-- Decrement (subtracting of 1)
--a (pre increment)—first decrement then processing
a-- (post increment)—first processing then decrement
JavaScript Assignment Operators
Assignment operators are used to assign values to JavaScript variables.
Operator Example Identical to
= a = b a = 10
+= a += b a = a + b
-= a -= b a = a - b
*= a *= b a = a * b
/= a /= b a = a / b
%= a %= b a = a % b
**= a**= b a = a ** b
3.4 COMPARISON OPERATORS
To determine equality or difference between variables or values, comparison operators are utilised in logical
statements.
Web Scripting—JavaScript 183

