Calculate The Number Of Digits After Decimal Point – countDecimals.js

Category: Javascript | September 1, 2020
Author:TanishShinde
Views Total:164 views
Official Page:Go to website
Last Update:September 1, 2020
License:MIT

Preview:

Calculate The Number Of Digits After Decimal Point – countDecimals.js

Description:

A super tiny JavaScript utility to count the number of digits after the decimal point in a number.

How to use it:

1. Download the library and insert the countDecimals.js right before the closing body tag.

<script src="countDecimals.js" async></script>

2. Determine the number in which you need to calculate the number of digits after the decimal point.

countDecimals(1)
// => 0
countDecimals(1.25)
// => 2
countDecimals(1.125)
// => 3
countDecimals(3/7)
// => 17

You Might Be Interested In:


Leave a Reply