What is the difference between parseInt() and Number()?

前端 未结 10 910
無奈伤痛
無奈伤痛 2020-11-22 12:02

How do parseInt() and Number() behave differently when converting strings to numbers?

10条回答
  •  执念已碎
    2020-11-22 12:18

    I always use parseInt, but beware of leading zeroes that will force it into octal mode.

提交回复
热议问题