Function floatToPercent

  • EN: Floating point number to percentage 0.2 => 20%

    ZH: 浮点数转为百分比 0.2 => 20%。

    Usage:

    const ret1 = floatToPercent(0.2);
    const ret2 = floatToPercent(0.2, 2);
    console.log(ret1);
    console.log(ret2);

    Output:

    20%
    20.00%
    

    Parameters

    • num: number

      浮点数

    • fixSize: number = 0

      保留几位浮点数

    Returns string