Functions consuming and/or producing Booleans

The following comparisons are used in JavaScript: <, <=, >, and >=, for both numbers and strings. Due to ordering by Unicode values, upper-case letters come before lower-case letters in the ordering.

For equality and inequality, there are two sets of operations: both == and === check for equality, and both != and !== check for inequality. When you use == or !=, JavaScript may convert the types of the values to try to compare them. (Notice the caution symbol appearing on line 10.) For === and !== the same type is required.

Boolean and is computed using && and or using ||. Both use short-cut evaluation (that is, the and computation stops when the first false value is found and the or computation stops when the first true is found when evaluating from left to right). To compute not, use !.

Note:

Hints:

  • undefined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
var numOne = 345.2, numTwo = 45234;
var strOne = "a string", strTwo = "another string";
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX