Gets the name of a number, even if it's stupidly big. Supersedes TheoryOfNekomata/number-name.
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

count-to-one-million.js 436 B

1234567891011121314151617
  1. const { default: getNumberName } = require('../packages/core')
  2. const fs = require('fs')
  3. const path = require('path')
  4. const main = async () => {
  5. const ws = fs.createWriteStream(path.resolve(__dirname, 'count-to-one-million.out.csv'))
  6. ws.write('number,name\n')
  7. for (let i = 0; i <= 1000000; i++) {
  8. if (i % 1000 === 0) {
  9. console.log(i)
  10. }
  11. ws.write(i + ',' + getNumberName(i) + '\n')
  12. }
  13. ws.close()
  14. }
  15. void main()