Chapter 2. Implement program flow

Being able to manipulate the Document Object Model (DOM), create animations, and use the various application programming interfaces (APIs) provided by the JavaScript library is a great skill to have. To leverage the power of the user experience fully, however, you need to provide users with certain website functions only under certain conditions, a concept known as program flow. Without program flow, JavaScript programs would process from top to bottom in the order in which the code was written. This is useful in some cases, but in most situations in which a dynamic user experience is required, logic needs to be processed conditionally. Program flow can be conditional, iterative, or behavioral:


Get Exam Ref 70-480: Programming in HTML5 with JavaScript and CSS3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.