Page 297 - Web Applications (803) Class 11
P. 297
Example: To multiply two numbers using multiplication assignment operator.
<HTML>
<BODY>
<SCRIPT>
var x = 10;
x *= 5;
document.writeln("output "+ x);
</SCRIPT>
</BODY>
</HTML>
Following is the output of the above code:
Lab Assignment ‘n Activity Interdisciplinary
Create JavaScript programs to calculate the following and display the result with appropriate messages:
1. Area and perimeter of a rectangular lawn
2. Simple Interest
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.
The comparison operators are explained in the table below, assuming x = 8.
Operator Name Description Example Output
== equal to It is used to compare the value of a variable against x==7 false
the value of other variable or directly with some x==8 true
other value.
!= not equal tIt is used to check if two operands being evaluated x!=8 false
are not equal. Then this gives the value true.
> greater than It is used to check whether any expression generates x>8 false
a value greater than other expressions; if so, then
the value would evaluate to true; else false. ’
Introduction to Dynamic Websites Using JavaScript 295

