Last active
August 29, 2015 14:03
-
-
Save appikonda/99239871802e820d4a1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// convert integer to string; 10 -> "10" | |
var foo = 10; | |
undefined | |
foo.toString(); | |
"10" | |
// convert string to integer; "10" -> 10 | |
var swing = "10"; | |
undefined | |
parseInt(swing); | |
10 | |
// display integer with 3 decimal places; 10 -> 10.000 | |
foo.toFixed(3); | |
"10.000" | |
or | |
foo.toPrecision(5); | |
"10.000" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perfect