Convert Numbers Into English Words

Category: Javascript , Text | October 22, 2021
Author:humanwhocodes
Views Total:26 views
Official Page:Go to website
Last Update:October 22, 2021
License:MIT

Preview:

Convert Numbers Into English Words

Description:

A JavaScript library that converts arbitrary positive integers into English words.

See Also:

How to use it:

1. Install and import the Number to Words library.

# Yarn
$ yarn add @humanwhocodes/number-to-words

# NPM
$ npm i @humanwhocodes/number-to-words
// node
const { numberToWords } = require("@humanwhocodes/number-to-words");
import { numberToWords } from "@humanwhocodes/number-to-words";
// browser
<script type="module">
  import { numberToWords } from "https://cdn.skypack.dev/@humanwhocodes/number-to-words?min";
</script>

2. Convert a number (must be positive interger) into English words.

numberToWords(12345)
// => twelve thousand three hundred forty-five

You Might Be Interested In:


Leave a Reply