title: JQuery - Values from JSON into split() then update var
body: <p>I have an JSON array, and 2 of the keys and multiple values, i want to split each value, and if one of the values exist then it will set a var to 1.</p>
  
  <pre><code>var heroism = 0;
  var stats = 0;
  var crit = 0;
  var stamina = 0;
  var spellPower = 0;
  var spellHaste = 0;
  var mastery = 0;
  var attackPower = 0;
  var attackHaste = 0;
  
  var classes = {
      mage: [{
          0: "mage",
          1: 0,
          2: "heroism, crit, spellPower"
      }],
  ...
  };
  
      $.each(classes, function (key, data) {
          $.each(data, function (index, data) {
              if (data[1] == 1) {
                  var i = 0;
                  var getBuffs = data[2].split(', ');
                  $.each(getBuffs, function (key, data) {
  
                  // update relevant var to 1
                  data[i] = 1;
                  i++;
  
              });
              $.each(getBuffs, function (key, data) {
                  $.each(data, function (index, data) {
                      console.log('index', data);
                  });
              });
  
          } else if (data[3] == 1) {
              //do something else   
          }
      });
  });
  </code></pre>
  
  <p>What it is currently doing is putting each letter as an array object rather than the whole word. I think this part is wrong <code>data[i] = 1;</code> </p>
  
  <p>My full code can be found <a href="http://jsfiddle.net/Qju8D/1/" rel="nofollow">here</a></p>
  
  <p>Thanks</p>