How to assign value in the callback function?
<p>I am having issues with a <code>callback</code> function</p>

<pre><code>project.prototype.getFolder = function(path){

    this.imagePath;
    var instance = this;

    function getImage(image, callback) {
       var it = function(i){
         codes.....
         //I am sure variable image is not null
                  callback(image);

         codes....
        }
    }

   // function to get the image
   getImage(image, function (img) {
        instance.imagePath = img;
   });

   //it outputs undefined...
   console.log(this.imagePath )

}
</code></pre>

<p>I want to assign the value to <code>this.imagePath</code> inside the <code>callback</code> function, but it seems I am getting <code>undefined</code> in my case.
I am sure I pass valid <code>image</code> variable but I am still getting nothing. Can anyone provide a tip? Thanks a lot!</p>
