Example 2: Open your notepad and type the following lines of code.
At the end of this practice, you will practically see how loops work in JavaScript. <HTML> <HEAD> <TITLE>Testing JavaScript Loop Statement</TITLE> </HEAD>
90
<BODY> <PRE> A for loop that writes out the numbers from 0 through 9 and labels them as being odd or even. <SCRIPT Language="JavaScript"> <!-for (i=0; i < 10; i++) { if (i%2 != 0) [Link](i + " is odd") else [Link](i + " is even") } // --> </SCRIPT> </PRE> </BODY> </HTML>
2012-07-02
Huawei Proprietary - Restricted Distribution
Page1, Total1