Replacing numbers with words

This javascript code below generates a countdown of numbers that appears over a mobile video screen: https://bit.ly/3onLYZG (I’ve shortened the long link). When you go there and select “record from camera”, you’ll see (via mobile view) the countdown.
This javascript is from here (starting on line 778):
https://gist.github.com/daemonsy/61a7f05bf6dbe23444076af93c582815

   // countdown
        countdown_screen = $("#"+dom_id+"-countdown-screen").addClass("cameratag_screen");
        countdown_status = countdown_screen.find(".cameratag_countdown_status");
        if (countdown_screen.length == 0) {
          countdown_screen = $('<div class="cameratag_screen cameratag_count"></div>');
          var countdown_prompt = $('<div class="cameratag_prompt">'+CT_i18n[9]+' </div>');
          countdown_status = $('<div class="cameratag_countdown_status"></div>');
          countdown_screen.append(countdown_status);
          countdown_screen.append(countdown_prompt);
        }
        // add to DOM
        container.append(countdown_screen);

I’m trying to get help with just having words/text appear instead of numbers. Any guidance is appreciated.

It’s actually the function starting on line 988 you need to look at…specifically, line 1004.

Much thanks for your reply.
Any additional guidance on how to change from numbers to words is welcomed.

That’s… a much broader subject. You’d have to determine how big of a number you wanted to handle; but generally speaking, you need two functions.
A number-to-text formatter for the Scientific Groupings,
A number-to-text formatter for the Sub-Groupings. The first function will call this one with the number-of-that-grouping.

Run the first on the number until there are no more groupings, and then run the second.

Thanks again. I’m not sure if I’m asking the right question. I don’t know what you mean by “You’d have to determine how big of a number you wanted to handle”. What I’m trying to accomplish is instead of numbers appearing, I’d like text to appear there instead, like a headline of text, not a timed countdown of any kind. I hope that is clearer and less complicated.

I understand what you’re asking for. I dont know if YOU know what you’re asking for.

Let’s say I program a system with the words Zero One Two Three… Nine.
If I give that system “10”, it tells me my time is “One Zero”.
I specified my system to handle numbers up to 9.

Where do you draw your line? a thousand? a million? billions? quintillions?

If I understand the question then there are plenty of previous answers. If none of those help then please clarify what you need.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.