IsNumber(value, [minValue], [maxValue]) Last updated: 02. Feb 2024
Checks if specified value is a number.
Parameters
Name | Type | Description |
---|---|---|
value | object | Value to validate. |
minValue (optional) | number | Specify a minimum value for the number or "null" to skip. |
maxValue (optional) | number | Specify a maximum value for the number or "null" to skip. |
Returns
Returns true if value is a number (within the specified range).
Example
Code example (JS)
JS is normal JavaScript either running in the browser or on the Docly™ server.let t = "test";
if (!docly.isNumber(t))
write("'test' is not a number \n");
let n = 123;
if (docly.isNumber(n, 100, 200))
write("123 is a number between 100 and 200\n");
if (!docly.isNumber(n, 1, 10))
write("123 is NOT a number between 100 and 200");
Output
The JS code above produces the output shown below:'test' is not a number
123 is a number between 100 and 200
123 is NOT a number between 100 and 200