Function floatFixed

  • EN: Keep the specified number of decimal places for floating-point numbers.

    ZH: 浮点数保留指定位。

    Usage:

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

    Output:

    0
    0.20
    

    Parameters

    • num: string
    • size: number = 0

    Returns string