Create a number from a number-like value.
bigint
This validates that the value is a number-like value, and that the resulting number is not NaN or Infinity.
NaN
Infinity
const value = createNumber('0x010203');console.log(value); // 66051const otherValue = createNumber(123n);console.log(otherValue); // 123
The created number.
If the value is not a number-like value, or if the resulting number is NaN or Infinity.
The value to create the number from.
Create a number from a number-like value.
bigint
, it is converted to a number.This validates that the value is a number-like value, and that the resulting number is not
NaN
orInfinity
.Example
Returns
The created number.
Throws
If the value is not a number-like value, or if the resulting number is
NaN
orInfinity
.