Members
(static) EPSILON :number
2.220446049250313e-16
Type:
- number
(static) MAX_INT8 :number
127
Type:
- number
(static) MAX_INT16 :number
32767
Type:
- number
(static) MAX_INT32 :number
2147483647
Type:
- number
(static) MAX_SAFE_INTEGER :number
9007199254740991
Type:
- number
(static) MAX_UINT8 :number
255
Type:
- number
(static) MAX_UINT16 :number
65535
Type:
- number
(static) MAX_UINT32 :number
4294967295
Type:
- number
(static) MAX_UINT32 :number
4294967296
Type:
- number
(static) MAX_VALUE :number
1.7976931348623157e+308
Type:
- number
(static) MIN_INT8 :number
-128
Type:
- number
(static) MIN_INT16 :number
-32768
Type:
- number
(static) MIN_INT32 :number
-2147483648
Type:
- number
(static) MIN_SAFE_INTEGER :number
-9007199254740991
Type:
- number
(static) MIN_VALUE :number
5e-324
Type:
- number
(static) NaN :number
NaN
Type:
- number
(static) NEGATIVE_INFINITY :number
-Infinity
Type:
- number
(static) NEGATIVE_ZERO :number
-0
Type:
- number
(static) POSITIVE_INFINITY :number
Infinity
Type:
- number
(static) POSITIVE_ZERO :number
+0
Type:
- number
(static) UNSAFE_INTEGER :number
9007199254740992
Type:
- number
(static) UWORD8 :number
256
Type:
- number
(static) UWORD16 :number
32768
Type:
- number
(static) WORD8 :number
128
Type:
- number
(static) WORD16 :number
65536
Type:
- number
(static) WORD32 :number
2147483648
Type:
- number
Methods
(static) clamp(number, min, max) → {number}
Returns a number clamped to the range set by min and max.
Parameters:
Name | Type | Description |
---|---|---|
number |
* | |
min |
* | |
max |
* |
Returns:
- Type
- number
(static) clampToInt(num, min, max) → {number}
Returns an integer clamped to the range set by min and max.
The arguments are converted to integers with the toInteger method.
Parameters:
Name | Type | Description |
---|---|---|
num |
* | |
min |
* | |
max |
* |
Returns:
- Type
- number
(static) inRange(value, min, max) → {boolean}
Returns true if the operand value is greater than or equal to min and is less than or equal to max.
Parameters:
Name | Type | Description |
---|---|---|
value |
NumberLike | |
min |
NumberLike | |
max |
NumberLike |
Returns:
- Type
- boolean
(static) isFinite(number) → {boolean}
The function determines whether the passed value is finite.
More robust version of the original global isFinite.
Parameters:
Name | Type | Description |
---|---|---|
number |
* |
- Source:
- See:
Returns:
- Type
- boolean
(static) isInt8(inputArg) → {boolean}
The $.Number.isInt8() method determines whether the passed value is an integer.
If the target value is an integer in the range -2^7 through 2^7-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isInt16(inputArg) → {boolean}
The $.Number.isInt16() method determines whether the passed value is an integer.
If the target value is an integer in the range -2^15 through 2^15-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isInt32(inputArg) → {boolean}
The $.Number.isInt32() method determines whether the passed value is an integer.
If the target value is an integer in the range -2^31 through 2^31-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isInteger(inputArg) → {boolean}
The isInteger method determines whether the passed value is an integer.
If the target value is an integer, return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
- Source:
- See:
Returns:
- Type
- boolean
(static) isNaN(inputArg) → {boolean}
The function determines whether the passed value is NaN. More robust version of the original global isNaN.
NOTE This function differs from the global isNaN function (18.2.3) is that it does not convert its argument
to a Number before determining whether it is NaN.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
- Source:
- See:
Returns:
- Type
- boolean
(static) isNegativeZero(inputArg) → {boolean}
Returns true if the operand inputArg is the number -0.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isNumber(inputArg) → {boolean}
Returns true if the operand inputArg is a Number.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isNumberAny(inputArg) → {boolean}
Returns true if the operand inputArg is a number literal or object.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isNumberObject(inputArg) → {boolean}
Returns true if the operand inputArg is a number object.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isOdd(inputArg) → {boolean}
The Number.isEven returns true if the integer is even otherwise false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
number |
Returns:
- Type
- boolean
(static) isOdd(inputArg) → {boolean}
The Number.isOdd returns true if the integer is odd otherwise false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
number |
Returns:
- Type
- boolean
(static) isPositiveZero(inputArg) → {boolean}
Returns true if the operand inputArg is the number 0 or +0.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isSafeInteger(inputArg) → {boolean}
The isInteger method determines whether the passed value is an integer.
If the target value is an integer, return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
- Source:
- See:
Returns:
- Type
- boolean
(static) isUint(inputArg) → {boolean}
The $.Number.isUint() method determines whether the passed value is an integer.
If the target value is an integer in the range 0 through 2^53-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isUint8(inputArg) → {boolean}
The $.Number.isUint8() method determines whether the passed value is an integer.
If the target value is an integer in the range 0 through 2^8-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isUint16(inputArg) → {boolean}
The $.Number.isUint16() method determines whether the passed value is an integer.
If the target value is an integer in the range 0 through 2^16-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isUint32(inputArg) → {boolean}
The $.Number.isUint32() method determines whether the passed value is an integer.
If the target value is an integer in the range 0 through 2^32-1, inclusive,
return true, otherwise return false.
If the value is NaN or infinite, return false.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) isZero(inputArg) → {boolean}
Returns true if the operand inputArg is the number 0.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- boolean
(static) mod(a, b) → {number}
The mod/remainder operator returns the first operand modulo of the second operand, that is,
number1 modulo number2, in the preceding statement, where number1 and number2 are numbers.
The modulo function is the integer remainder of dividing number1 by number2.
For example, 12 % 5 returns 2. The result will have the same sign as number1; that is, -1 % 2 returns -1.
Truncating division
Parameters:
Name | Type | Description |
---|---|---|
a |
* | |
b |
* |
- Source:
- See:
Returns:
- Type
- number
(static) modulo(dividend, divisor) → {number}
The Number.modulo function is a modified implementation of the `%` operator. This algorithm uses the
formula `remainder = dividend - divisor * quotient`; the `%` operator uses a truncating division.
Known as Rounding division, Floored division or Integer division.
Parameters:
Name | Type | Description |
---|---|---|
dividend |
number | |
divisor |
number |
- Source:
- See:
Returns:
- Type
- number
(static) outRange(value, min, max) → {boolean}
Returns true if the operand value is less than or equal to min or is greater than or equal to max.
Parameters:
Name | Type | Description |
---|---|---|
value |
NumberLike | |
min |
NumberLike | |
max |
NumberLike |
Returns:
- Type
- boolean
(static) parseFloat(inputArg) → {number}
This method parses a string argument and returns a floating point number.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
StringLike |
- Source:
- See:
Returns:
- Type
- number
(static) parseInt(inputArg, radix) → {number}
This function parses a string argument and returns an integer of the specified radix or base.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
StringLike | |
radix |
number |
- Source:
- See:
Returns:
- Type
- number
(static) randomInt(minopt, max) → {number}
Returns a random integer between the supplied min and max arguments.
If no arguments are supplied or are the same then 0 and 1 will be used.
If min is not supplied then 0 is used.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
min |
number |
<optional> |
|
max |
number |
- Source:
- See:
Returns:
- Type
- number
(static) toFixed(fractionDigits) → {string}
This method formats a number using fixed-point notation.
Parameters:
Name | Type | Description |
---|---|---|
fractionDigits |
number |
- Source:
- See:
Returns:
- Type
- string
(static) toInt8(inputArg) → {number}
The abstract operation converts its argument to one of 2^8 integer values in
the range -2^7 through 2^7-1, inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toInt16(inputArg) → {number}
The abstract operation converts its argument to one of 2^16 integer values in
the range -2^15 through 2^15-1, inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toInt32(inputArg) → {number}
The abstract operation converts its argument to one of 2^32 integer values in
the range -2^31 through 2^31-1, inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toInteger(inputArg) → {number}
The function evaluates the passed value and converts it to an integer.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
- Source:
- See:
Returns:
- Type
- number
(static) toLength(inputArg) → {number}
The abstract operation ToLength converts its argument to an integer suitable for use as the length
of an array-like object.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
- Source:
- See:
Returns:
- Type
- number
(static) toNumber(inputArg) → {number}
The abstract operation ToNumber converts its argument to a value of type Number.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toUint(inputArg) → {number}
The abstract operation converts its argument to one of 2^53 integer values in
the range 0 through 2^53-1,inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toUint8(inputArg) → {number}
The abstract operation converts its argument to one of 2^8 integer values in
the range 0 through 2^8-1,inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toUint16(inputArg) → {number}
The abstract operation converts its argument to one of 2^16 integer values in
the range 0 through 2^16-1,inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number
(static) toUint32(inputArg) → {number}
The abstract operation converts its argument to one of 2^32 integer values in
the range 0 through 2^32-1,inclusive.
Parameters:
Name | Type | Description |
---|---|---|
inputArg |
* |
Returns:
- Type
- number