1// parseFloat takes in a string value and converts it to a float
2// The parseFloat function will look at the first character of
3// the string and decided whether that character is a number or not
4// If not the parseFloat function will return Nan
5
6let stringNumber = "8.0"
7
8let floatNuumber = parseFloat(stringNumber);
1var myInt = parseInt("10.256"); //10
2var myFloat = parseFloat("10.256"); //10.256
1<script language="JavaScript" type="text/javascript">
2var a = "3.3445";
3var c = parseFloat(a);
4alert(c);
5</script>
6
1const num = 123; //> type number 123
2const str = num.toString(); //> type string "123"