I'm trying to return arr when final() is called....
function final(){
var arr;
fs.readFile("/my/path/", 'utf8' ,(err, data) => {
arr = parsing(data);
arr.splice(-1,1);
});
return arr;
}
It keeps returning undefined. Even though arr inside the readFile brackets gives me an array...
The possible duplicate discusses printing whereas I need a value to use somewhere else. How can I use the value arr in another function/module?