Home »
Archive by category "Online Computer Education" (Page 10)
The label statement lets you specify a reference point in your script. Typically, the label statement is associated with loops. A label statement can be referenced by either the break or continue statement. The syntax of the label statement is shown here: label: statements; In the following example, I have created a label called CounterLoop. When the script executes the first time, the label statement is ignored. Within the while...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
The do…while statement executes a loop until a condition becomes false. The syntax of the do…while statement is outlined below: do { statements; } while (condition) The difference between the do…while loop and the while loop is that the do…while loop always executes at least once. This is because the condition is checked at the end of the first execution of the loop instead of at the beginning. However, you can...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
The while statement executes a loop as long as a condition is true. The syntax of the while statement is shown here: while (condition) { statements; } For example, you might write a while loop that looks like this: while (counter > 0) { counter++; document.write(“counter = “, counter , “<BR>”); } In the next example, I set up a loop that runs as long as the value assigned...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
A loop is a series of statements that executes repeatedly, allowing you to perform iterative operations within your script. JavaScript and JScript statements that support looping logic include the for, while, do…while, label, break, and continue statements. The nice thing about loops is that they enable you to write just a few line of code and then to execute them repeatedly, making your scripts easier to write and maintain....
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
Comment statements have no effect on the logical performance of the script. However, they can be used to make scripts easier to understand by providing you with a means of internally documenting your scripts. You can place a comment in your scripts in either of two ways. To place a single comment line within the body of your script, type // followed by your comment, as shown here: //This...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
The switch statement evaluates a series of conditional tests or cases and executes additional statements based on whether the case proves true. The syntax of the switch statement is shown here: switch (expression) { case label: statements; break; . . . case label: statements; break; default: statements; } The switch statement compares the result of the expression against the label for each case. The statements for the first case that...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
JavaScripts and JScripts consist of a series of statements. These statements are the programming instructions, or logic, that you write to tell the scripts what you want them to do. Using Conditional Statements to Alter Script Flow Conditional statements enable you to test for various conditions and take action based on the results of the test. Specifically, conditional statements execute when the tested condition proves to be true. Conditional...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
Having introduced you to the String object, it seems only proper at this point in the discussion that I talk a little about the Math object as well. This object is created automatically in every JavaScript and JScript, so you do not have to create an instance of it as you do with the String object. You can simply refer to the Math object when you need to. Like...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
Page 10 of 13« Prev
1
…
7
8
9
10
11
12
13
Next »