Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • What is fastest is dependant on the optimizations in a given implementation at a given time. There's no objectively "fastest" way. Commented Oct 12, 2012 at 15:48
  • 2
    What should be done with '1a' string? With ' 1' one? In other words, why most common methods to do that (Number(x) and parseInt(x, 10)) are not sufficient to you? Commented Oct 12, 2012 at 15:50
  • A previous jsperf test: jsperf.com/converting-string-to-int/3 Commented Oct 12, 2012 at 15:50
  • here a good performance comparison of the different methods: jsben.ch/#/NnBKM Commented Oct 25, 2016 at 8:12
  • See Also: How to convert a string to an integer in JavaScript? Commented Oct 12, 2021 at 19:41