I'm trying to get parseFloat to convert a userInput
(prompt
) into a number.
For example:
var userInput = prompt("A number","5,000")
function parse_float(number) {
return parseFloat(number)
}
When userInput = 5,000
, parse_Float(userInput)
returns 5
.
However, if the user was inputting a value to change something else (ie: make a bank deposit or withdrawl) Then I to work properly, parse.Float(userInput)
needs to return 5000
, not 5
.
If anyone could tell me how to do this it would help me so much. Thanks in advance.