title: Where is a way to run javascript code remotely?
body: <p>I want to be able to run live code remotely. Therefor, I want to be able to run some arbitrary code on machine A and then, transfer some of that code to machine B and continue running it from machine B.</p>
  
  <p>I find out that I can get the source code of any function via <code>fn.toString()</code>.</p>
  
  <p>Example:</p>
  
  <pre><code>var foo = function(a, b) { return a + b; }
  
  console.log(foo.toString()); // prints "function (a, b) { return a + b; }"
  </code></pre>
  
  <p>So far so good, but what happens in this case?</p>
  
  <pre><code>var bar = (function() {
      var x = 5;
  
      return function(a) { return a + x; }
  })();
  
  console.log(bar.toString()); // prints "function (a) { return a + x; }"
  </code></pre>
  
  <p>In this case there is no way to get the variable <code>x</code>, so I can't run it on a remote machine.</p>
  
  <p>Any suggestions?</p>