Functions consuming and/or producing Booleans

The following comparisonsA function that compares data and returns a Boolean value. are used in JavaScript: <, <=, >, and >=, for both numbers and strings. Due to ordering by UnicodeAn international standard for encoding symbols. 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 evaluationA way of evaluating Boolean expressions joined by and or or so that in some cases not all need to be evaluated before the answer is determined. (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