Skip to content

conversion-library / numberToExponential

Function: numberToExponential()

ts
function numberToExponential(value: number, fractionDigits?: number): string

numberToExponential

version: v0.0.15+

Parameters

value: number

传入数字

fractionDigits?: number

指定科学计数法的小数位数

Returns

string

科学计数法的字符串

Example

ts
numberToExponential(123456)
// 1.23456e+5
numberToExponential(123456, 2)
// 1.23e+5
numberToExponential(123456.78)
// 1.2345678e+5

Defined in

lib/number-conversion/numberAndExponential.ts:22