title: Javascript get variable into brackets
body: <p>I am getting some data from a url which looks like this:</p>
  
  <pre><code>{"654":{"name”:”…etc}
  </code></pre>
  
  <p>I have this data in a variable called <code>result</code>.</p>
  
  <p>If I do this:</p>
  
  <pre><code>var mydata = [{"654":{"name”:”…etc}];
  </code></pre>
  
  <p>it works fine but if I do this:</p>
  
  <pre><code>var mydata = [+result+];
  </code></pre>
  
  <p>or </p>
  
  <pre><code>var mydata = [result];
  </code></pre>
  
  <p>I get error so my question is how do I get this to work so I can do:</p>
  
  <pre><code>var mydata = [ +mydatahere+ ];
  </code></pre>
  
  <p>?</p>