H I O X INDIA
Javascript Tutorial
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Java-Script Tutorial
Introduction
Variables
Operators
Statements
Loops
Functions
Objects
Arrays
Browser Objects
Form DOM
Ask Your Doubts
Feedback





Javascript Convert Values


Topic

Converting a string data type to float in javascript?
How to convert a float, interger value to string?



Explanation

c) Converting String to Float
To convert a value from string to float, we have to use the function or method "parseFloat() to convert a string value to float.

Example Result
parseFloat("4.333"); 4.333
parseFloat("5aaa"); 5
parseFloat("6e2"); 600
parseFloat("aaa"); NaN (means "Not a Number")

d) Converting Integer/Float to String
Integer (int) or float value can be converted to string by using the function or method toString().

Example Result
var a = 3.22;
a.toString();
"3.22"
var a = 5;
a.toString();
5

Example Code:
<script language="javascript">
var a = 32;
var b = 333;
var c = a.toString()+b;
document.write(" to String function "+c);
</script>


Result:


        Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script. Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.

others

privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links