How to convert number to exponential format in Javascript

Description

toExponential() method format the number in exponential notation. toExponential() accepts the number of decimal places to output as the argument.

Example


var num = 10; 
console.log(num.toExponential(1)); //"1.0e+1" 

The code above generates the following result.





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window