1var str1 = '10,00 fr';
2var str2 = '12.22 $';
3
4function getCurrencySymbol(str) {
5 //replace all numbers, spaces, commas, and periods with an empty string
6 //we should only be left with the currency symbols
7 return str.replace(/[\d\., ]/g, '');
8}
9
10console.log(getCurrencySymbol(str1));
11console.log(getCurrencySymbol(str2));
1var str1 = '10,00 €';
2var str2 = '12.22 $';
3
4function getCurrencySymbol(str) {
5 //replace all numbers, spaces, commas, and periods with an empty string
6 //we should only be left with the currency symbols
7 return str.replace(/[\d\., ]/g, '');
8}
9
10console.log(getCurrencySymbol(str1));
11console.log(getCurrencySymbol(str2));