Generate array from comma-separated value string
<p>I have a string that is sent to my JavaScript via PHP that looks like this:</p>

<pre><code>var string = "[ 'string 1','string 2 ','string 3' ]"
</code></pre>

<p>I want to split this string and get rid of the symbols <code>[</code>, <code>]</code> and <code>'</code> to produce the array</p>

<pre><code>var array = {
    string 1, 
    string 2,
    string 3,
}
</code></pre>

<p>My current method uses a bunch of replaces, splits and loops. It seems very inefficient, and I want a better/more efficient method.</p>
