0

hello guys..... i need a help about javascript

how to convert number (ex. 1) ----> to a word (ex, one)?

here it is.... ....if i will input a number like 20 it will then displayed a word twenty..
(the numerical 20 --------> become a word "twenty")


thankz in advance

Edited by uselessninja: n/a

4
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by uselessninja
0

you would need to create a data dictionary.

var numbers = [];

numbers[0] = 'zero';
numbers[1] = 'one';
numbers[2] = 'two';
numbers[3] = 'three';
numbers[4] = 'four';
...

Have fun with that.

0

you would need to create a data dictionary.

var numbers = [];

numbers[0] = 'zero';
numbers[1] = 'one';
numbers[2] = 'two';
numbers[3] = 'three';
numbers[4] = 'four';
...

Have fun with that.

^^ thankz with that sir but what if i input 1,000,000 or above?
do i manually make a data dictionary up to million or beyond? or there is a code that do
all the conversion?

0

There is no code to do the conversion. You could make an algorithm that could reduce a bit of the work, but you are kinda stuck my friend. You can try googling but I've never seen it before (beyond a hundred or so).

0

uhmm.... can u teach me how to set up that in html?... have 1 button and 2 textbox (1 textbox is where u input a number then the 2nd is to display the result) thankzz so much^^

Is that not exactly the same as the demo?

Airshow

0

Is that not exactly the same as the demo?

Airshow

i mean... just set up this in html...and send me the ready made of this coz im just starting javascript ^^

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.