0
How can we build a program in which if we will put number so it will give it's spelling in JavaScript
Like if user will give number 20 so in alert it will say twenty
2 Answers
+ 1
First, youâll need to hard-code all the spellings: One - Nine, Ten - Ninety (by tens), Hundred, Thousand, Million.. etc. You can put these spellings in a dictionary and/or make case statements based on the length of the whole number and then iterate through each sub-number. Try an attempt, and then we can try to clean up your code!
0
You can use switch/case for this purpose