Function toInteger

  • Converts value to an integer.

    Note: This method is loosely based on ToInteger.

    Parameters

    • value: any

      The value to convert.

    Returns number

    Returns the converted integer.

    5.5.0

    [[isInteger]], [[isNumber]], [[toNumber]]

    toInteger(3.2)
    // => 3

    toInteger(Number.MIN_VALUE)
    // => 0

    toInteger(Infinity)
    // => 1.7976931348623157e+308

    toInteger('3.2')
    // => 3