1function eArabic(x){
2 return x.toLocaleString('ar-EG');
3}
4
5console.log(eArabic(123456.789));
6// expected output: "١٢٣٬٤٥٦٫٧٨٩"
7
8console.log(eArabic('123456.789'));
9// expected output: "123456.789"
10
11console.log(eArabic(NaN));
12// expected output: "ليس رقم"
13
14