title: JavaScript Recursive Callback Function - ReferenceError: function is not defined
body: <p>My idea is to show all images in the array. At first the Noise image is getting hidden after this it calls the showArray() function to show the images in the Array.</p>
  
  <pre><code>Trial = (function() {
    function Trial(imageArray) {
      this._images = new Array();
      this._images = imageArray;
    }
  
    Trial.prototype.startTrial = function() {
      return $("#noise").hide(0, showImages());
    };
  
    Trial.prototype.showImages = function() {
      var imageToShow;
      imageToShow = this._images.pop();
      if (imageToShow === void 0) {
        $("#noise").show;
        return;
      }
      $("#img").attr("src", imageToShow.src);
      return $("#img").fadeIn(0).delay(imageToShow.delay).fadeOut(0, showImages());
    };
  
    return Trial;
  
  })();
  
  image1 = new AMPImage("someImage1.png", 500);  //imagePath, delay in ms
  image2 = new AMPImage("someImage2.png", 750);
  image3 = new AMPImage("someImage3.png", 1000);
  
  myImageArray = [image1, image2, image3];
  trial1 = new Trial(myImageArray);
  trial1.startTrial();
  </code></pre>
  
  <p>But on executing startTrial()  I get the error message </p>
  
  <blockquote>
    <p>ReferenceError: showArray is not defined</p>
  </blockquote>