Looking for a better solution than a bunch of switch statements in my JavaScript I'm calling this function from my html (and in some cases from another function in my JavaScript).  These type of switch statements are starting to litter my code.  Is there a more elegant solution to these if statements?  I wish I could pass a reference to the variables I want to modify.  I'm finally asking the question because now I have a situation where if I do it this same way, I'm going to have an ugly switch statement with hundreds of cases which I'm guessing not only looks ugly, but will hurt performance.

function incCriteriaStats(exp){
    switch (exp) {
      case "a":
        numOfA++;
        break;
      case "b":
        numOfB++;
        break;
      case "c":
        numOfC++;
        break;
      case "d":
        numOfD++;
        break;
      case "e":
        numOfE++;
        break;
      case "f":
        numOfF++;
        break;
      case "g":
        numOfG++;
        break;    
    }
|
Use an object, with the keys being the letters, and then you can just do:

function incCriteriaStats(exp) {
        if(exp in obj)
             obj[exp]++;
}