Skip to content

Function: percentageChange()

ts
function percentageChange(from, to): number;

Percent change from from to to ((to - from) / from * 100). 从 fromto 的涨跌幅百分比。

Parameters

ParameterTypeDescription
fromnumberOriginal value / 原值
tonumberNew value / 新值

Returns

number

Percent change / 变化百分比

Example

ts
percentageChange(100, 120) // => 20

Since

1.0.0

Released under the MIT License.