Sams Teach Yourself JavaScript in 24 Hours

Sams Teach Yourself JavaScript in 24 Hours

By Michael Moncur

Quiz

Test your knowledge of JavaScript loops by answering the following questions.

Questions

1:

Which type of JavaScript loop checks the condition at the end of the loop?

  1. for
  2. while
  3. do...while
A1:

c. The do...while loop uses a condition at the end of the loop.

2:

Within a loop, what does the break statement do?

  1. Breaks the user's computer.
  2. Starts the loop over.
  3. Escapes the loop entirely.
A2:

c. The break statement escapes the loop.

3:

The statement while (3==3) is an example of:

  1. A typographical error.
  2. An infinite loop.
  3. An illegal JavaScript statement.
A3:

b. This statement creates an infinite loop.

Share ThisShare This

Informit Network