Convert Large Numbers Into Words – digit.js

Category: Javascript | June 24, 2023
Author:editorrust
Views Total:162 views
Official Page:Go to website
Last Update:June 24, 2023
License:MIT

Preview:

Convert Large Numbers Into Words – digit.js

Description:

digit.js is a JavaScript library that converts large numbers (larger than 6 digits) into human-readable words (like 2.1 Million, 5.0 B, etc).

It supports numbers up to Quattuorvigintillions and also has the ability to format numbers with commas as thousands separators.

See Also:

How to use it:

1. Download and load the digit.js library.

<script src="main.js"></script>

2. Convert numbers into words.

// 2.1 Million
toWord(2100000);
// 2.1 M
toWord(2100000, "short");

3. Format numbers with commas as thousands separators.

// 2,100,000
commas(2100000);

Changelog:

v0.2.1 (06/24/2023)

  • Numbers under one million in toWord can now preserve decimal precision up to three points.

v0.2.0 (03/31/2023)

  • there’s 3x as much code!
  • it can now handle large numbers up to Novemvigintillion!
  • there’s date and time formatting!
  • Date formatting in mdy and dmy
  • Time in 12 or 24 hour
  • The time between two dates, or one date and the present

You Might Be Interested In:


Leave a Reply