【发布时间】:2014-07-01 00:22:56
【问题描述】:
需要第二双眼睛...发现这有什么问题吗?我的内部函数没有返回值。我一定是把范围弄乱了?
function getGroups(account){
var name;
// name = 'assigned'; I work
account.getGroups(function(err, groups) {
//removed logic for simple debugging
name ='test';
//return name;
});
return name;
}
在父函数(即var name = 'assigned')中分配变量时,它可以工作。
【问题讨论】:
标签: javascript node.js scope