I'm beginning to teach myself javascript and am having trouble returning from a function inside a promise. My code, essentially, looks like this:
foobar = function(x,y){
    //code that doesn't matter
    return promiseFunction(
        function(results){
           console.log("promise completed")
           console.log(output)
           return output;}
        function(err){throw error;});
console.log(foobar('1','2'));
This prints
undefined
promise completed
what I want the result to be
I'm new to asynchronous programming and am not certain what I am doing wrong.
 
     
     
    