How can I convert float to String in javascript ?? Need ASAP
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.
The search for people who can answer your question continues for as long as needed - until you find the answer you were looking for.
When an answer is posted by someone who was invited (byYedda or by yourself) to answer your question, their answer is marked with a yellow "invited by Yedda".
To be invited to answer other people's questions in your areas of knowledge and interest, be sure to list your favorite topics:
» My Settings My Topics.
Of course, the more helpful your answers are, the more likely you are to be invited to future questions...
Got an answer for MBW1185? Would you like to comment on the posted answers, or vote for the one which you think is the best?
Sign up for a free account, or sign in (if you're already a member).
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