Match Currency Symbol - Javascript

Match Currency Symbol - Javascript

code snippet

javascript
// reference: https://www.w3schools.com/charsets/ref_utf_currency.asp
function getCurrencySymbol(currencyname) {
    var currentysymbol= '$';
    switch(currencyname.toUpperCase()) {
        case 'AED':
            currentysymbol = 'د.إ';
            break;
        case 'EUR':
            currentysymbol = '€';
            break;
        case 'CRC':
            currentysymbol = '₡';
            break;
        case 'CHF':
            currentysymbol = 'CHF';
            break;
        case 'DKK':
        case 'NOK':
        case 'SEK':
            currentysymbol = 'kr';
            break;
        case 'GBP':
            currentysymbol = '£';
            break;
        case 'IDR':
            currentysymbol = 'Rp';
            break;
        case 'ILS':
            currentysymbol = '₪';
            break;
        case 'INR':
            currentysymbol = '₹';
            break;
        case 'JPY':
        case 'CNY':
            currentysymbol = '¥';
            break;
        case 'KRW':
            currentysymbol = '₩';
            break;
        case 'NGN':
            currentysymbol = '₦';
            break;
        case 'PHP':
            currentysymbol = '₱';
            break;
        case 'PLN':
            currentysymbol = 'zł';
            break;
        case 'PYG':
            currentysymbol = '₲';
            break;
        case 'THB':
            currentysymbol = '฿';
            break;
        case 'UAH':
            currentysymbol = '₴';
            break;
        case 'VND':
            currentysymbol = '₫';
            break;
        case 'ZAR':
            currentysymbol = 'R';
            break;
        default:
            currentysymbol= '$';
            break;
    } 
    return currentysymbol;
}

"The measure of who we are is what we do with what we have"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.