javascript - How do I parse a long number string to just a number? -


i have ids need converted strong numbers whenever use parseint() or number(), double type decimal

1.01038295007818e+016.0 

i need convert string number.

the parseint() function takes first number of string , removes decimal places, returns integer:

var = parseint("1.000350001");  var b = parseint("456789.1");  var c = parseint("20");    console.log(a);  console.log(b);  console.log(c);

the math.floor() method rounds number downward nearest integer:

var d = math.floor("1234.00101");    console.log(d);

the number() function converts string number represents strings value:

var e = number("1000.12");    console.log(e);

for question, believe either parseint or math.floor work fine, unless number greater javascripts largest available number


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -