Skip to content

Instantly share code, notes, and snippets.

@JordanDelcros
Created June 4, 2021 13:49
Show Gist options
  • Save JordanDelcros/86f454c5e832c5c4e6d4b00ff739a8fb to your computer and use it in GitHub Desktop.
Save JordanDelcros/86f454c5e832c5c4e6d4b00ff739a8fb to your computer and use it in GitHub Desktop.

Revisions

  1. Bluu renamed this gist Jun 4, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Bluu created this gist Jun 4, 2021.
    6 changes: 6 additions & 0 deletions Fixed number without .toFixed()
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    // Default 2 numbers after comma
    function fixNumber( number, precision = 1e2 ){

    return Math.sign(number) * (Math.round((Math.abs(number) + Number.EPSILON) * precision) / precision);

    }