【发布时间】:2014-03-06 17:55:22
【问题描述】:
我开始自学 javascript,但无法从 Promise 中的函数返回。我的代码基本上是这样的:
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'));
这会打印出来
undefined
promise completed
what I want the result to be
我是异步编程的新手,不确定自己做错了什么。
【问题讨论】:
标签: javascript asynchronous promise