title: Convert string to array - jQuery.inArray() not working
body: <p>I have a string that looks like this (this is a value I get from an input in the page's HTML):</p>
  
  <pre><code>'[123,234,345]'
  </code></pre>
  
  <p>I turn this value into an array in my JS:</p>
  
  <pre><code>var tempProjectTasks = $('#task_id_array').val();
  tempProjectTasks = tempProjectTasks.replace('[', '').replace(']','');
  selectedProjectTasks = tempProjectTasks.split(',');
  </code></pre>
  
  <p>I then compare this array in a loop</p>
  
  <pre><code>$.each(tasks, function(key, value) {
      if ($.inArray(value['id'], selectedProjectTasks) != -1) {
          checked = 'checked';
      } else {
          checked = '';
      }
      ... more stuff here ...
  });
  </code></pre>
  
  <p>This is building a list for the HTML and each row contains a checkbox.</p>
  
  <p>I can see in the console the comparison for these values being <code>-1</code> by adding the <code>console.log</code> commands below inside the loop.</p>
  
  <pre><code>console.log(selectedProjectTasks);
  console.log(value['id']);
  console.log($.inArray(value['id'], selectedProjectTasks));
  </code></pre>
  
  <p>In the console:</p>
  
  <pre><code>["123","234","345"]
  123
  -1
  </code></pre>
  
  <p>Why is the <code>inArray()</code> not finding the matching values? What have I missed? Thanks</p>