$Id: review-language.txt,v 1.1 2006/02/24 14:04:45 locasto Exp $ Spring 2006 COMS1001 ---------------------------------------------------------------------- 0) What is the difference between a statement and an expression? An expression involves 1 or more operators and their operands. An expression evaluates to a value. A statement is a more general construct that can include many expressions. 1) What is control flow? Control flow is the idea that the sequence of program statements is important when computing a solution. A particular ordering of statements has one (possibly non-unique) result and another ordering of statements may have a different result. Control flow describes the possible orderings of program statements. Control flow is defined by certain programming language constructs like function calls, decision control structures, and repetition control structures. In Javascript, control flow begins at the first Javascript statement and proceeds linearly, executing each statement in turn, until the end of the program is reached. This "straight-line" control flow can be modified by using function calls, decision control structures (if, switch, break, continue, return), and repetition control structures (while, do..while, for). Control flow can be described by a control flow diagram or flowchart. Such a diagram describes all possible paths. Particular runs of a program don't necessarily follow all paths. Thus, control flow is not just 1 particular execution ordering or sequence of program statements, but rather all possible collections of sequences that are legal due to the program text. 2) How do you run a Javascript program? Simply view it in a browser, or if you have already executed it, refresh the page. 3) What are the basic elements of a Javascript program? The basic elements are variables and functions: data and the statements that operate on that data. 4) How do you form a single line comment in Javascript? Start the line with // 5) How do you form multi-line comments in Javascript? Start with /* and end with */