Originated From QueryCAT
Javascript will convert types automatically if you just use them in a context where that needs to happen. For example, you can just add an empty string to your float and the result will be a string:
var x = 3.14952;var y = x + '';window.alert( typeof x ); // numberwindow.alert( typeof y ); // string
You can also do explicit casting, but it's usually not necessary.
robertc is very right. In case you may also be looking for String-to-float: that is not as automatic. You can use the globally defined function parseFloat(f). so parseFloat("0003.1415") would result in 3.1415. ParseFloat (and also parseInt) will skip any leading non-number characters btw, such as US$ e.g.
Other people asked questions on similar topics, check out the answers they received:
Other people asked questions on various topics, and are still waiting for answer. Would be great if you can take a sec and answer them