mardi 20 octobre 2015

Optimize if condition javascript

I am just a newbie in javascript, this is how i am writing if condition in a javascript,

function setAccType(accType) {
    if (accType == "PLATINUM") {
        return "Platinum Customer";
    } else if (accType == "GOLD") {
        return "Gold Customer";
    } else if (accType == "SILVER") {
        return "Silver Customer";
    }
},

Is there a better way to do it?

Aucun commentaire:

Enregistrer un commentaire