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] ] } ]  
0

1 Answer 1

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)]
};
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.