0

I am trying to return the results of 2 functions, but I am not succeeding. I am doing the following:

var x = getFunctionResults1(items);
var y = getFunctionResults2(items);
return {x,y}

But getting this output:

[ { x: [ [Object], [Object], [Object], [Object], [Object] ],
    y: [ [Object] ] },
  { x: [ [Object], [Object] ], y: [ [Object] ] } ]  
Pablo.K
  • 1,041
  • 2
  • 10
  • 15

1 Answers1

2

You could use an array as result object for two functions, like

return [getFunctionResults1(functionResults1), getFunctionResults2(functionResults2)];

or use an object for the parts with a key, like

return {
    result1: getFunctionResults1(functionResults1),
    result2: getFunctionResults2(functionResults2)]
};
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392