@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function toNumber

    • Converts a value to a number

      将值转换为数字

      Parameters

      • v: unknown

        The value to convert. 要转换的值

      Returns number

      The converted number, or NaN if conversion is not possible. 转换后的数字,如果无法转换则返回 NaN

      toNumber('42') // => 42
      toNumber('hello') // => NaN
      toNumber(undefined) // => NaN