Formatting numbers for locales The toLocaleString function produces a string with a language-sensitive representation of the number. function eArabic(x) { return x.toLocaleString("ar-EG");}console.log(eArabic(123456.789));// Expected output: "١٢٣٬٤٥٦٫٧٨٩"console.log(eArabic("123456.789"));// Expected output: "123456.789"console.log(eArabic(NaN));// Expected output: "ليس رقم"