Function isNumber

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

    const util = require('util');

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

    Deprecated

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

    Parameters

    • object: unknown

    Returns object is number

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

    const util = require('util');

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

    Deprecated

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

    Parameters

    • object: unknown

    Returns object is number

Generated using TypeDoc