title: Array displays zero length and no value with each()
body: <p>I am more familiar with PHP than with JQuery and kind of stuck on arrays. I have read just about all the posts on the forum on this subject but can't get it to work.</p>
  
  <p>I have what I believe to be an array.
  Something that would look like this in php</p>
  
  <pre><code>myArr = ['option-4' =&gt; '3','option-1' =&gt; '8', 'option-3' =&gt; '0' ];
  </code></pre>
  
  <p>In JQuery I can retrieve the values by use of the command</p>
  
  <pre><code>var x = myArr['option-1'];
  </code></pre>
  
  <p>This all works fine but what I need to do is make a string of the values. So I need to loop through the elements and add the value of the element to the string. The problem is the loop.</p>
  
  <p>When I check the length of the array </p>
  
  <pre><code>alert("Elements in array "+myArr.length);
  </code></pre>
  
  <p>it always returns zero.</p>
  
  <p>When I try something like</p>
  
  <pre><code>$.each(myArr , function(i, val) { 
    alert(myArr[i]); 
  });
  </code></pre>
  
  <p>Nothing shows.</p>
  
  <p>I am missing something obviously, my PHP knowledge must be blocking things.
  Can anyone please help?</p>