I use a custom function to convert numbers to arabic format like this :
const numbers = `۰۱۲۳۴۵۶۷۸۹`;
const convert = (num) => {
let res = "";
const str = num.toString();
for (let c of str) {
res += numbers.charAt(c);
}
return res;
};
And it works like this :
console.log(convert(123)) // ==> ۱۲۳
The problem occurs when there is a number with decimals and it converts it to arabic format without the decimal dots for example :
console.log(convert(123.9)) // ==> ۱۲۳۹
I expect the output to be ۱۲۳،۹ .
How can I convert numbers with decimals to arabic format with decimal dots included with my function ?