How does parseInt() in Javascript work?

后端 未结 4 1454
挽巷
挽巷 2021-01-28 12:25



        
4条回答
  •  孤街浪徒
    2021-01-28 13:18

    For more information please refer to documentation

    Note: Only the first number in the string is returned!

    Note: Leading and trailing spaces are allowed.

    Note: If the first character cannot be converted to a number, parseInt() returns NaN.

    Note: Older browsers will result parseInt("010") as 8, because older versions of ECMAScript, (older than ECMAScript 5, uses the octal radix (8) as default when the string begins with "0". As of ECMAScript 5, the default is the decimal radix (10).

提交回复
热议问题