storeEval: storing function return value

I was wondering what would be the best way to store a return value from js function to variable which could later be used in some of the following lines?
I understand that you can do a simple math calculation or string manipulation in “target” field and in in “value” field put the variable where to store it. What about some more complicated js functions with loops. In a normal js function I would use return statement.
Is there a way to use the variable that was initiated and used inside the js function or is there a way to specify what is to be stored into variable specified in the “value” field?

Thank you in advance

I am not sure if I fully understand the question. Could you post some sample JS code that you would like to run in Kantu?