title: Convert variable name to string in Javascript?
body: <p>I've seen a few other posts about this on Stack Overflow, but the answer always seems to be to create an object with key / value pairs. This doesn't seem to be what I need in my current situation. What I'm wanting to do: I have different arrays which could possibly contain a username. I want to check each array and see if the username is present as a value in them. If it is, I'd like a string representation of a name of the array variable. Example:</p>
  
  <pre><code>var array = ['apple', 'orange', 'grape'];
  var array2 = ['apple', 'pear', 'plumb']
  
  member_arrays = new Array();
  // I'd like this block to be dynamic in that i don't have to specify the array name 
  // in the inArray or member_arrays[member_arrays.length+1] (just loop through my arrays
  // and add a string representation of the array name to the member_arrays array)
  if ($.inArray( 'apple', array ) != -1)
    member_arrays[member_arrays.length] = 'array';
  if ($.inArray( 'apple', array2) != -1)
    member_arrays[member_arrays.length] = 'array2';
  // etc...
  </code></pre>