返回JavaScript中多个函数的结果
我试图返回两个函数的结果,但没有成功。我正在做以下工作:返回JavaScript中多个函数的结果,javascript,function,return,Javascript,Function,Return,我试图返回两个函数的结果,但没有成功。我正在做以下工作: var x = getFunctionResults1(items); var y = getFunctionResults2(items); return {x,y} 但要获得这个输出: [ { x: [ [Object], [Object], [Object], [Object], [Object] ], y: [ [Object] ] }, { x: [ [Object], [Object] ], y: [ [Obje
var x = getFunctionResults1(items);
var y = getFunctionResults2(items);
return {x,y}
但要获得这个输出:
[ { x: [ [Object], [Object], [Object], [Object], [Object] ],
y: [ [Object] ] },
{ x: [ [Object], [Object] ], y: [ [Object] ] } ]
可以将数组用作两个函数的结果对象,如
return [getFunctionResults1(functionResults1), getFunctionResults2(functionResults2)];
或者将对象用于带有关键点的零件,如
return {
result1: getFunctionResults1(functionResults1),
result2: getFunctionResults2(functionResults2)]
};
可以将数组用作两个函数的结果对象,如
return [getFunctionResults1(functionResults1), getFunctionResults2(functionResults2)];
或者将对象用于带有关键点的零件,如
return {
result1: getFunctionResults1(functionResults1),
result2: getFunctionResults2(functionResults2)]
};