23.07.2013 Views

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

JavaScript/JScript: Control Structures I - Pearson Learning Solutions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2008934301<br />

Chapter 14 <strong>JavaScript</strong>/<strong>JScript</strong>: <strong>Control</strong> <strong>Structures</strong> I 399<br />

Outline<br />

14.1 Introduction<br />

14.2 Algorithms<br />

14.3 Pseudocode<br />

14.4 <strong>Control</strong> <strong>Structures</strong><br />

14.5 The if Selection Structure<br />

14.6 The<br />

14.1 Introduction<br />

Before writing a script to solve a problem, it is essential to have a thorough understanding<br />

of the problem and a carefully planned approach to solving the problem. When writing a<br />

script, it is equally essential to understand the types of building blocks that are available<br />

and to employ proven program construction principles. In this chapter and in Chapter 15,<br />

we discuss these issues in our presentation of the theory and principles of structured programming.<br />

The techniques you learn here are applicable to most high-level languages, including<br />

<strong>JavaScript</strong>.<br />

14.2 Algorithms<br />

if/<br />

else Selection Structure<br />

14.7 The while Repetition Structure<br />

14.8 Formulating Algorithms: Case Study 1 (Counter-<strong>Control</strong>led<br />

Repetition)<br />

14.9 Formulating Algorithms with Top-Down, Stepwise Refinement: Case<br />

Study 2 (Sentinel-<strong>Control</strong>led Repetition)<br />

14.10 Formulating Algorithms with Top-Down, Stepwise Refinement: Case<br />

Study 3 (Nested <strong>Control</strong> <strong>Structures</strong>)<br />

14.11 Assignment Operators<br />

14.12 Increment and Decrement Operators<br />

14.13 A Note on Data Types<br />

14.14 <strong>JavaScript</strong> Internet and World Wide Web Resources<br />

Summary • Terminology • Self-Review Exercises • Answers to Self-Review Exercises • Exercises<br />

Any computing problem can be solved by executing a series of actions in a specific order.<br />

A procedure for solving a problem in terms of<br />

1. the actions to be executed, and<br />

2. the order in which these actions are to be executed<br />

is called an algorithm.<br />

The following example demonstrates that correctly specifying the<br />

order in which the actions are to be executed is important.<br />

e-Business and e-Commerce: How to Program, by Harvey M. Deitel, Paul J. Deitel, and Tem R. Nieto. Published by Prentice Hall.<br />

Copyright © 2001 by <strong>Pearson</strong> Education, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!