O'Reilly logo

JavaScript Recipes: A Problem-Solution Approach by Keith Cirkel, Russ Ferguson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Russ Ferguson and Keith Cirkel 2017
Russ Ferguson and Keith CirkelJavaScript Recipes10.1007/978-1-4302-6107-0_4

4. Working with Numbers and Math

Russ Ferguson and Keith Cirkel2
(1)
Ocean, New Jersey, USA
(2)
London, UK
 

Converting Strings to Numbers

Problem

Receive a value as a string and convert it to a number.
Caution
Methods attached to the Number object are part of ECMAScript 6 (ES6, the new standard of JavaScript). Older browsers that still in use, such as Internet Explorer 11 and below and Safari 7 and below, do not support these features (they work to the older ECMAScript 5 or ES5 standard). Check out http://kangax.github.io/es5-compat-table/es6/ for the current compatibility charts.

Solution

There are several ways to make this conversion. Global ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required