-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumber-converter.js
More file actions
33 lines (31 loc) · 837 Bytes
/
number-converter.js
File metadata and controls
33 lines (31 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const getEngToArNumber = (num) => {
let surahNumbers = parseInt(num, 10);
// English to Arabic:
const numbers = `٠١٢٣٤٥٦٧٨٩`;
const convert = (surahNumbers) => {
let res = "";
const str = surahNumbers.toString();
for (let c of str) {
res += numbers.charAt(c);
}
return res;
};
const converted = convert(surahNumbers);
return converted;
};
const getEngToBnNumber = (num) => {
let surahNumbers = parseInt(num, 10);
// English to Arabic:
const numbers = `০১২৩৪৫৬৭৮৯`;
const convert = (surahNumbers) => {
let res = "";
const str = surahNumbers.toString();
for (let c of str) {
res += numbers.charAt(c);
}
return res;
};
const converted = convert(surahNumbers);
return converted;
};
export { getEngToArNumber, getEngToBnNumber };