Skip to content

Instantly share code, notes, and snippets.

@appikonda
Last active August 29, 2015 14:03
Show Gist options
  • Save appikonda/99239871802e820d4a1b to your computer and use it in GitHub Desktop.
Save appikonda/99239871802e820d4a1b to your computer and use it in GitHub Desktop.
// 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"
@mohnish
Copy link

mohnish commented Jul 21, 2014

perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment