title: Any good suggestions for refactoring the following javascript code?
body: <p>Any ideas or suggestions for a more concise way to refactor this code?</p>
  
  <p>Maybe a loop solution or something like that?</p>
  
  <pre><code>this._featuredImage = '../../../../../../../../content/images/' + this.post.slug + '.jpg';
  this._checkImage(this._featuredImage, function() { // Image exists
    this.featuredImage = this._featuredImage;
  }.bind(this), function() { // Image doesn't exist
    this._featuredImage = '../../../../../../../../content/images/' + this.post.slug + '.png';
    this._checkImage(this._featuredImage, function() { // Image exists
      this.featuredImage = this._featuredImage;
    }.bind(this), function() { // Image doesn't exist
      this._featuredImage = '../../../../../../../../content/images/' + this.post.datestamp + '.jpg';
      this._checkImage(this._featuredImage, function() { // Image exists
        this.featuredImage = this._featuredImage;
      }.bind(this), function() { // Image doesn't exist
        this._featuredImage = '../../../../../../../../content/images/' + this.post.datestamp + '.png';
        this._checkImage(this._featuredImage, function() { // Image exists
          this.featuredImage = this._featuredImage;
        }.bind(this), function() { // Image doesn't exist
          this.featuredImage = false;
        }.bind(this));
      }.bind(this));
    }.bind(this));
  }.bind(this));
  </code></pre>
  
  <p>Thanks, I hope this makes sense.</p>