Parameter | Type | Description |
---|---|---|
VALUE1 | VALUE | The first value. |
VALUE2 | VALUE | The second value. |
VALUE | The lesser value. |
This function returns the lesser of the two provided values, comparatively. If both values are different types, they are interpreted as the value of the highest type, promotion-wise (if one value is a string, and the other is not, they are compared as strings). The type of the returned value is the same type as the lesser value.
a = min(-2, 2); // a = -2
a = min(6, 3.4); // a = 3.4
a = min("apple", "orange"); // a = "apple"
a = min("apple", "Apple"); // a = "Apple"
a = min(123, "pears"); // a = 123
Max — Returns the greater of two values.
Strings are compared lexicographically, which is character-order (not alphabetical). The sorting is based on the character values, not any kind of locale-based or linguistic significance.