JavaScript: Looping
(Control Structures)
View source code for the examples.
For Loop
javascript:fForLoop()
- example of for loops, nested for loops, break, continue, and using labels.
For/In Loop
javascript:fForInLoop_navigator()
- example of how the for/in loop can extract the property name and values of an object.
Property name and values for Objects:
javascript:fDisplayProperties('navigator')
javascript:fDisplayProperties('window')
javascript:fDisplayProperties('location')
javascript:fDisplayProperties('history')
javascript:fDisplayProperties('document')
Do/While Loop
javascript:fDoWhileLoop()
- the condition is evaluated at the end of the loop.
While Loop
javascript:fWhileLoop()
- the condition is evaluated at the beginning of the loop.
Case Statement
javascript:fCaseStatement()