August 2016
Beginner to intermediate
847 pages
17h 28m
English
Conditions provide a simple but powerful way to control the flow of code execution. Loops allow you to perform repetitive operations with less code. Let's take a look at:
if conditionsswitch statementswhile, do-while, for, and for-in loopsThe examples in the following sections require you to switch to the multiline Firebug console. Or, if you use the WebKit console, use Shift + Enter instead of Enter to add a new line.
Here's a simple example of an if condition:
var result = '', a = 3;
if (a > 2) {
result = 'a is greater than 2';
}The parts of the if condition are:
if statementa greater than 2?"{} that executes if the condition is satisfiedThe condition ...