How to retrun variable value to the js? [closed]

You can use add method like

var nodes = edges.add([returnNodes()]);

or

var nodes = new vis.DataSet([,returnNodes()]);