numerica
    Preparing search index...

    Function toWords

    • Converts a number to its written word representation.

      Parameters

      • n: number

        The number to convert to words

      • options: Options = {}

        Configuration options

        • hyphens

          Use hyphens in compound numbers like "twenty-one" (default: false)

        • and

          Include "and" (British style: "one hundred and five") (default: false)

        • separator

          Separator between words (default: " ")

      Returns string

      The number spelled out in words

      toWords(42)                          // "forty two"
      toWords(42, {hyphens: true}) // "forty-two"
      toWords(105, {and: true}) // "one hundred and five"
      toWords(1234) // "one thousand two hundred thirty four"
      toWords(1000000) // "one million"
      toWords(0) // "zero"
      toWords(3.14) // "three point one four"
      toWords(0.5) // "zero point five"