This chapter describes the various control structures in the JS language and demonstrates how to use them to fulfill requirements. The chapter begins with an overview of the block statements supported in JavaScript. Next, the if...else and the switch statements are covered in detail. You will then be introduced to the various types of loops supported in JavaScript, including the for and while loops, and given demo programs showing how to execute them. The chapter wraps up with brief coverage of the LABEL statement.
Block Statement
A block is used for grouping a set of statements. ...