Number.toExponential

toExponential — Returns a string representation of the specified Number object.

Description

Number.toExponential([integer decimals])

Parameters

Name Description Type Default Optional
decimals A number between 0 and 20 representing number of digits. integer Yes

Examples

Example #1 – toFixed example
var n = new Number(42.12345); console.log(n.toExponential()); // Will be the primitive string "4.212345e+1". console.log(n.toExponential(2)); // Will be the primitive string "4.21e+1". console.log(n.toExponential(4)); // Will be the primitive string "4.2123e+1". console.log(n.toExponential(8)); // Will be the primitive string "4.21234500e+1".

External references