Skip to content

isNumber ​

The isNumber function checks if the provided value is of type number.

Syntax ​

typescript
isNumber(value: any): value is number;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is a number

Examples ​

typescript
isNumber(123); // => true
isNumber("123"); // => false

Notes ​

  • Useful for validating numeric values before mathematical operations.

References ​

Released under the MIT License.