As part of the programming work for the Islam-Archive project, I encountered the problem of how I could convert the numbers from Latin to Arabic. Then I came across toLocaleString .
What is toLocaleString?
toLocaleString makes it possible to convert numbers into other languages. For example, 2019 will be ٢٠١٩ or २०१९ or ௨௦௧௯. If you want to get directly into the matter, you can do it directly on the MDN page:
To be considered
The only thing you have to keep in mind is that the passed number has actually been declared as Number. This function can not edit strings and automatically convert them to a number.
My application
I have used this function to convert the suras and verse numbers. Thus I have the display of the number once in Latin and once in Arabic.