Statements in Sequential Structures

Sequential structures refer to the order in which the code is entered into a JavaScript program. In one sense, all code is sequential, but I am using the structure to differentiate it from statements that loop or conditionally execute lines of code.

Variable Declarations and Assignments

A simple statement that declares a variable using var is all that a variable declaration does. Typically, a variable is declared and assigned a value at the same time; however, technically, the two types of statements are different. For example, a perfectly legitimate variable declaration is this one:

							var myFineVariable; //Declaration 

Later in the script, the developer may assign a value to the declared variable. For example, ...

Get JavaScript Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.