Page 194 - Web_Application_v2.0_C12_Fb
P. 194
Operator Name Description Example Output
(a=3)
*= Multiplication It multiplies right operand with the left operand and assigns a *= 3 9
assignment the result to left operand. x*=3 is equivalent to x=x*3.
/= Division It divides left operand with the right operand and assigns a /= 3 1
assignment the result to left operand. x/=3 is equivalent to x=x/3.
%= Remainder It takes modulus of two operands and assigns the result to a %= 3 0
assignment left operand. x%=3 is equivalent to x=x%3.
**= Exponent It raises the value of a variable to the power of the right a **= 3 27
assignment operand. x = x**=3
Example 5: To multiply two numbers using multiplication assignment operator
<html>
<body>
<script>
var x = 10;
x *= 5;
document.writeln("output "+ x);
</script>
</body>
</html>
Output:
Lab Assignment ‘n Activity 21 st Century #Critical Thinking
Skills
Complete the following activity and tick on the circle.
1. Create JavaScript programs to calculate the following and display the result with
appropriate messages:
Area and perimeter of a rectangular lawn
Simple Interest
2. Try the following code snippets and check the output:
document.write( “WELCOME” + “TO” + “ALL”)
document.write (10+12+ “234”)
Comparison Operators
To determine equality or difference between variables or values, comparison operators are utilised in logical
statements.
192 Touchpad Web Applications (Ver. 2.0)-XII

