The Goal Of JSnumberToWordProcessor Is A Well Formatted Human ReadableNumber,
With It's CorrespondingWords.
JSnumberToWordProcessor Is A Pure Vanilla JavaScript Plugin With No Dependencies.
- Fixed Display Of Multiple Zeros Greater Than 2 Length.
- If A Decimal Place Length Greater Than 2 Is Specified, And Its Corresponding Decimal Number Is 0, Application Would Fallback To A 2 Decimal Place Number of (.00)
e.g
JSnumberToWordProcessor(26.00000232, 5)
would return26.00
instead of26.00000
- If A Decimal Place Length Greater Than 2 Is Specified, And Its Corresponding Decimal Number Is 0, Application Would Fallback To A 2 Decimal Place Number of (.00)
- Correct Decimal Place Word With Starting Zeros
e.g
JSnumberToWordProcessor(26.00002, 5)
Now ReturnsTwenty-Six (dot) Two tenths
Instead OfTwenty-Six (dot) undefined Thousand, and Two hundred-thousandths
repl.it
Use Onrepl.it
Use Onrepl.it
Use On// Navigate To https://repl.it/languages/Nodejs#index.js// On repl.it Call... const JSnumberToWordProcessor = ; // Pass In A Single Number-String (with or without a decimal number argument); // OR An Array Of Numbers;
HTML Script
HTML Script
HTML Script
NPM Installation
NPM Installation
NPM Installation
npm i js-number-to-word-processor
ES5 module:
ES5 module:
ES5 module:
const JSnumberToWordProcessor = ;
ES6 module:
;
AMD loader libraries such as requireJS:
;
e.g
877373863274895753n or '877373863274895753'
OR
BigInt(245786743890965998) or '245786743890965998'
Call JSnumberToWordProcessor & PASS In Either A Positive Whole Number, BigInteger, OR Number-String
NOTE <br/ >
Always Use BigInteger / BigInt or Number String When Dealing With Big Numbers Above 2^53-1
e.g
877373863274895753n or '877373863274895753'
OR
BigInt(245786743890965998) or '245786743890965998'
Call JSnumberToWordProcessor & PASS In Either A Positive Whole Number, BigInteger, OR Number-String
NOTE <br/ >
Always Use BigInteger / BigInt or Number String When Dealing With Big Numbers Above 2^53-1
e.g
877373863274895753n or '877373863274895753'
OR
BigInt(245786743890965998) or '245786743890965998'
Call JSnumberToWordProcessor & PASS In Either A Positive Whole Number, BigInteger, OR Number-String
NOTE <br/ >
Always Use BigInteger / BigInt or Number String When Dealing With Big Numbers Above 2^53-1 Always Use BigInteger / BigInt or Number String When Dealing With Big Numbers Above 2^53-1
e.g
877373863274895753n or '877373863274895753'
OR
BigInt(245786743890965998) or '245786743890965998'
Call JSnumberToWordProcessor & PASS In Either A Positive Whole Number, BigInteger, OR Number-String
; // 987: Nine Hundred and Eighty-Seven
; // 8,476,787,747: Eight Billion, Four Hundred and Seventy-Six Million, Seven Hundred and Eighty-Seven Thousand, Seven Hundred and Forty-Seven
; // 5,876,985,876,950: Five Trillion, Eight Hundred and Seventy-Six Billion, Nine Hundred and Eighty-Five Million, Eight Hundred and Seventy-Six Thousand, Nine Hundred and Fifty
; // 0: Zero
PASS An Array Of Positive Whole Number, BigInteger, OR Number-Strings
;
;
PASS A Decimal Numbers
; // 5,876.99: Five Thousand, Eight Hundred and Seventy-Six (dot) Ninety-Nine hundredths
; // 5,876.98,588: Five Thousand, Eight Hundred and Seventy-Six (dot) Ninety-Eight Thousand, Five Hundred and Eighty-Eight hundred-thousandths
PASS A Negative Numbers
; // -876,950: (negative) Eight Hundred and Seventy-Six Thousand, Nine Hundred and Fifty
; // -8,769.50: (negative) Eight Thousand, Seven Hundred and Sixty-Nine (dot) Five tenths
When Solving Arithmetic Calculations (+), Always Pass Arguments As Numbers, OR BigIntegers,
Other Arithmetic Operations Could Be Passed In As A Numbers, BigInteger, OR As A String.
SOLVE Arithmetic Operations When Solving Arithmetic Calculations (+), Always Pass Arguments As Numbers, OR BigIntegers, <br />
Other Arithmetic Operations Could Be Passed In As A Numbers, BigInteger, OR As A String.
; // 5: Five
; // 605: Six Hundred and Five
; // 61,605: Sixty-One Thousand, Six Hundred and Five
; // 44: Forty-Four
; // 66: Sixty-Six
; // 166,375: One Hundred and Sixty-Six Thousand, Three Hundred and Seventy-Five
; // 1: One
; // 47: Forty-Seven
; // 10.17: Ten (dot) Seventeen hundredths
; // 44: Forty-Four
; // 0.60: Zero (dot) Sixty
Use BigInteger / BigInt
; // 21,209,401,372,879,911,350,250,244,140,625: Twenty-One Nonillion, Two Hundred and Nine Octillion, Four Hundred and One Septillion, Three Hundred and Seventy-Two Sextillion, Eight Hundred and Seventy-Nine Quintillion, Nine Hundred and Eleven Quadrillion, Three Hundred and Fifty Trillion, Two Hundred and Fifty Billion, Two Hundred and Forty-Four Million, One Hundred and Forty Thousand, Six Hundred and Twenty-Five
; // 50: Fifty
NOTE:
The Second Argument Would Only Be Called On A Decimal Number
If The Second Argument Is Greater Than The Decimal Point Length, A Default 2 Decimal Point Would Be Used
Define The Decimal Place Length With A Second Number Argument Define The Decimal Place Length With A Second Number Argument
NOTE:
The Second Argument Would Only Be Called On A Decimal Number
If The Second Argument Is Greater Than The Decimal Point Length, A Default 2 Decimal Point Would Be Used
; // -475.99,885: (negative) Four Hundred and Seventy-Five (dot) Nine Hundred and Ninety-Eight Thousand, Eight Hundred and Fifty-Three millionths
;
; // 63.88,889: Sixty-Three (dot) Eighty-Eight Thousand, Eight Hundred and Eighty-Nine hundred-thousandths
; // 7.00: Seven
; // 46.900: Forty-Six (dot) Nine Hundred thousandths
; // 475.9,828,853: Four Hundred and Seventy-Five (dot) Nine Million, Eight Hundred and Twenty-Eight Thousand, Eight Hundred and Fifty-Three ten-millionths
;
NOTE: 0 === false && 1 === true
PROCESS Booleans NOTE: 0 === false && 1 === true
; // 1: One
; // 0: Zero
; // 0: Zero
; // 1:
; // 0: Zero
; // 1: One
How To Use JSnumberToWordProcessor Plugin In Your Project
- Install JSnumberToWordProcessor Plugin In Your Project File
OR
Download, And AttachcurStrLengthFunc_2.min.js
&JSnumberToWordProcessor.js
Script To Your HTML Document. - Ensure You Pass in The Number Argument As A String OR As A BigInter().
This Is Because JavaScript Has A Number Length Limit Of 2^53-1.
But If You Would Be Dealing With Numbers Less Than 2^53-1 Length,
Then Feel Free To Input A Number As Your Argument.
For Decimal Numbers
Pass A The Second Argument Which Could either Be A Number Or A String. If No Second Argument Is Passed In For Decimal Numbers Or The Second Argument Is Greater Than The Actual Decimal Number Length, A default Value Of 2 Decimal Number Length Is Used.
e.g
JSnumberToWordProcessor('123456.78998765', 5)
OR
JSnumberToWordProcessor(['123.98765', '445.556', '68', '8575.7766', '84974'], 3)
. -
Alternatively;
Just Append(n)
(Without Parentheses) to The End Of The Number Longer Than 2^53-1
e.g.
123456789098765432n
OR
[123456789098765433n, BigInt(123456789098765434), 123456789098765434n]
.
This Calls The BigInt() Method Which Allows JavaScript To Handle BIG Numbers.
-
Better Still;
Just Check JSnumberToWordProcessor's index.html & See How It's Been Put To Use
OR
Check Proforma Invoice Calculator To See JSnumberToWordProcessor At Work
- Display The Result In Your Project.
- Corrected Application Dismissal Of Starting Zeros After A Decimal Point.
- Application Now Handles Decimal Numbers, With Fractions.
- For decimal numbers, users can pass in a second argument which would indicate the decimal number length
- If a second argument isn't passed in for decimal numbers, a default 2 decimal point would be used
- Application Now Handles Negative Numbers.
- Application Can Solve Arithmetic Operations and Output The Result In Human Readable Number & Word
- Corrected Read Me installation process.
- Code Optimized.
- Application Can Now Process Numbers Up To "
10^33003
", Into Human Readable Numbers & Words Based On Conway-Wechsler Numbering System. - Optimized Code For Efficiency (Rewrote Most Part).
- Pure Vanilla JS With No Dependencies.
- Application Can Now Handle Numbers Larger Than
2^53-1
Up To10^126
. - Spelling Errors Corrected.
- Code Refined.
NPM
Install FromNPM
Install FromNPM
Install FromGitHub
Get Source Code FromJSnumberToWordProcessor
Use Live Site @Proforma Invoice Calculator is Another Application Using #JSnumberToWordProcessor
JavaScript Number To Word Processor Is Developed By Saheed Odulaja.
Feel Free To Fork This Repository.
Also Be Kind Enough To Leave A STAR 🌟 As A Mark Of Encouragement 😃.