Identify and correct the errors in each of the following. [Note: There may be more than one error in each piece of code.]
a.
```
if ( age >= 65 );
document.writeln( "Age greater than or equal to 65" );
else
document.writeln( "Age is less than 65 )";
```
b.
```
var x = 1, total;
while ( x <= 10 ) {
total += x;
++x;
}
```
c.
```
While ( x <= 100 )
total += x;
++x;
```
d.
```
while ( y > 0 ) {
document.writeln( y );
++y;
```
a.
1. Semicolon at the end of the if condition should be removed.
2. The closing double quote of the second document.writeln should be inside of the closing parenthesis.
b.
The variable total should be initialized to zero.
c.
1. The W in While should be lowercase.
2. The two statements should be enclosed in curly braces to properly group them into the body of the while other-
wise the loop will be an infinite loop.
d.
1. The ++ operator should changed to --.
2. The closing curly brace for the while loop is missing.
You might also like to view...
A _______________ involves the exclusive use of a rented computer and connection to the Internet that is housed in the web hosting company's premises.
a. virtual hosting agreement b. dedicated Web server c. co-located Web server d. private registration
Text that is used to provide content information about images to text only browsers is called ________ text
Fill in the blank(s) with correct word
When a video is selected on a slide, the Trim Video button is located on the ________ tab in the Editing group
A) Format B) Playback C) Animations D) Insert
Merging cells in a row at the top of the table is often done to create a(n) ____.
A. table heading B. information row C. title row D. caption row