January 2018
Intermediate to advanced
678 pages
20h 16m
English
parseInt, parseFloatWhen using all the number-crunching constructs you learned about in the previous sections, the first step is usually retrieving numeric input from the user. When the user types into a text control or a prompt dialog, JavaScript reads the input as a string. If you need numeric input, then the string must be parsed in order to convert it to a number. This section describes that process.
Parsing is the examination of text to determine what the text represents. The functions parseInt and parseFloat attempt to convert text to integers and decimal numbers, respectively. They are global functions in that they are not associated with an object, and so to call them, there’s no need to preface them with an ...
Read now
Unlock full access