the ability to use logical structures is one of the key
differentiating features of a prgramming language compared to
a markup language (like HTML or CSS)
programming logic allows the functionality you see in
programs; there are 2 main types:
conditional or branching logic
looping logic
these structures are not unique to JavaScript--you'll find
them in every compiled language.
Definitions
branching or conditional logic structures
these structures evaluate a specific value and then take
different actions based on the result.
in if structures, the evaluating
condition is an expression that results
in a boolean value.
the switch structure can be used
to evaluate a case with multiple (more than 2) outcomes
boolean value
value with only 2 states: true or
false.
looping logic structures
these structures evaluate a specific condition and perform
a set of actions until the terminal condition is reached
or the evaluation of the condition changes.
use for structures for loops with
a specified end point
use while structures for loops that
depend on the evaluative condition changing--but remember to code
in some way of checking or creating that change within your loop
or you could hang up your program in an infite loop.
terminal condition
a preset end-point, usually the end of a cycle of iteration (e.g.,
i<100→when 100 is reached, the loop will stop)