javascript toExponential Function

toExponential() function returns the exponential notation of a number.


var nm = 10000;
nm.toExponential(); //1e+4

var nm = 1000.433;
nm.toExponential(); //1.000433e+3

Use toPrecision() to round the decimals.
var nm = 54326 * 432211; //23480294786
nm.toExponential(); //2.3480294786e10
nm.toExponential(3);//2.348e10
endmemo.com © 2017  Terms of Use | Home