Skip to main content
isNumber - util - Node documentation
function isNumber

Usage in Deno

import { isNumber } from "node:util";
isNumber(object: unknown): object is number
Deprecated

Since v4.0.0 - Use typeof value === 'number' instead.

Returns true if the given object is a Number. Otherwise, returns false.

import util from 'node:util';

util.isNumber(false);
// Returns: false
util.isNumber(Infinity);
// Returns: true
util.isNumber(0);
// Returns: true
util.isNumber(NaN);
// Returns: true

Parameters

object: unknown

Return Type

object is number