Page 196 - Web Applications (803) Class 12
P. 196
Do you know?
An attacker can use JavaScript hijacking to pretend to be a legitimate user and read sensitive data
from a Web application that is vulnerable, especially one that uses Ajax (Asynchronous JavaScript and
XML). Nearly all significant Ajax apps have been discovered to be insecure.
3.8 LOOPS IN JAVASCRIPT
In a loop, a block of code or a set of instructions is repeated a
predetermined number of times in a computer program without
having to be written again until a predetermined condition is
fulfilled. In other words, loops allow you to repeatedly run one or
more statements in your code.
for loop
The for loop is an iterative statement used to check for specific conditions and then repeatedly run a block of
code as long as those conditions are satisfied.
Syntax:
for(initialization; condition; increment)
{//statements – body of loop }
Flow diagram:
Initialization/Starting
statement
Next iteration of the loop
Test True Execute
Statement Statement(s)
False
Exit from loop
Output of the preceding program is as follows:
194 Touchpad Web Applications-XII

