|
JavaScript Home
JavaScript Tutorial Home Basic JavaScriptIntroductionHow to Enable JavaScript JavaScript Syntax External JavaScript File JavaScript Operators JavaScript Variables JavaScript Functions JavaScript Events JavaScript If Statements JavaScript Switch Statements JavaScript While Loop JavaScript For Loop JavaScript Try Catch JavaScript Escape Characters JavaScript Void(0) Advanced JavaScriptJavaScript CookiesJavaScript Date and Time JavaScript Arrays Two Dimensional Arrays JavaScript Summary JavaScript ReferenceJavaScript Reserved WordsJavaScript Event Handlers JavaScript Date and Time Functions JavaScript Code LibraryJavaScript Dropdown MenuJavaScript Print JavaScript Alert Box JavaScript Status Bar Messages Image Rollovers Popup Windows JavaScript Redirect Timed JavaScript Redirect JavaScript Refresh Page Timed JavaScript Redirect Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
JavaScript For LoopWe learnt in the previous lesson that "loops" enable your program to continuously execute a block of code for a given number of times, or while a given condition is true. In that lesson, we saw that the While loop executes code while a condition is true. In this lesson, we will see that the JavaScript For loop executes code for a specified number of times. Therefore, we could rewrite the example from the previous lesson to use a for loop. Example For statement:
The resulting output: Exlanation of code
Enjoy this website?
Oh, and thank you for supporting Quackit! |
FREE Hosting!With every domain name you register with ZappyHost, you get FREE (ad supported) hosting.PLUS you get:
Featured Template:
(Build your websites in minutes!) |