Access variable outside scope? nodejs
<pre><code>function art(dataToArt){
  var figlet = require('figlet');
var result;
figlet(dataToArt, function(err, data) {
    if (err) {
        console.log('Something went wrong...');
        console.dir(err);
        return;
    }
    var result = data;
});
return result;
}

test = art('Hello World');

console.log(test);
</code></pre>

<p>Running this gives "undefined". How to access the changes made by function figlet to the variable result defined outside the function figlet.</p>