Controls: Booleans, Branch and Loops
Robert Jeansoulin · 2018
A control is a boolean context that is defined by the syntax of a conditional instruction: branch and loop. There are two boolean values: true and false. In a boolean context, the values of type string or number are cast to a boolean, and values undefined and null are evaluated as false. The value undefined is characteristic of a never defined variable. The type “undefined” applies to a never defined variable and to a never declared variable. The chapter focuses on boolean operators, relational operators and comparison operators. The boolean operators are evaluated with the shortcut rule: the next operand is evaluated depending on the status of the test after the previous operand evaluation. The chapter also focuses on exception handling and provides some examples for comparison operators, conditional instructions and ternary conditional operator.