title: Why aren't values in an array shown in console logs?
body: <p>I'm trying to get image dimensions.  here is my attempt with <code>.load</code></p>
  
  <pre><code>    function checkgallery_imagesize(src) {
            var dimensions = [];
  
            $("&lt;img/&gt;").load(function(){
                  dimensions.push(this.width);
                  dimensions.push(this.height); 
              }).attr("src", src);
  
            return dimensions;
           }
  
  var src = 'example.png';
  dimensions = checkgallery_imagesize(src);
  
  console.log(dimensions[0]); //width;
  console.log(dimensions[1]); //height;
  </code></pre>
  
  <p>When i use <code>console.log(dimensions)</code>.  I see the dimensions in the array but i can't access the array.  <code>dimensions[0]</code> and <code>dimensions[1]</code> are both undefined</p>