Loops
Loops give the JavaScript code you are writing the ability
to make decisions (with the Conditional part of the
statement) or perform a single task as many times as you
have a need for. These Conditional and Looping statements
were borrowed from older, more polished languages like C,
C++, and Java. Porting over the functionality of these very
capable languages gives JavaScript a very polished set of
very useful and functionally correct tools which you, the
developer, can work with.
Basically, a loop is just that - an action that occurs again
and again until a certain condition, set by you, is met,
thus satisfying the condition of the loop and stopping the
looped action. Used with the many operators available to
JavaScript, there is no limit on what your looped
expressions can do. There are four different loop structures
and three different statements that will be discussed in
this document. They are as follows.
- The for Loop
- The while Loop
- The do / while Loop
- The for / in Loop
- The break Statement
- The continue Statement
- The with Statement
The break, continue, and with statements are used within the
loop statements to provide a very specific functionality
that would either be non-existent or be very tedious. The
statement is there to help you, the developer, in writing
more efficient code with a smaller amount of typing. They
are fairly simply to use and are very straightforward.
There's no big tricks or hidden functionality, just well
designed and fully functional commands.
Variables
JavaScript Introduction
The JavaScript Array
The JavaScript Chronicles
JavaScript Introduction
Part 2: Data Types
Part 3: Arrays
Part 4: Operators
Part 5: Conditional Statements
Part 6: JavaScript Functions
Part 7: Pattern Matching - The RegExp Object
Part 8: Introduction to Server Side JavaScript
Part 9: Server Side JavaScript Mail Sending
Part 10: Server Side JavaScript and File Manipulation
Part 11: Working with Forms in JavaScript
Part 12: Getting to Know Dynamic HTML
|