0

I tried to google this question, but couldn't find a decent question. I am looking for a way to make this work:

  var testFunction = function() {
    console.log("it works");
  }

  send("testFunction");

I have no idea how to do it. I know this works in ruby though.

Max
  • 1,526
  • 2
  • 16
  • 19
  • 1
    What do you expect `send()` to do? – Brad Sep 20 '12 at 15:41
  • Can you describe what you want to do? – Parth Thakkar Sep 20 '12 at 15:42
  • Ok, i found the answer!! Sorry to bother people. But for those who want to know: var testFunction = function() { console.log("it works!"); }; eval("testFunction()"); – Max Sep 20 '12 at 15:44
  • 3
    @Max please do NOT use eval read this http://stackoverflow.com/a/198031/1230908 – Mattias Sep 20 '12 at 16:26
  • 1
    @Max, I think your example is not thorough enough to see what you want to do... why not do simply `testFunction();` !?!? – billy Sep 21 '12 at 02:42
  • @Mattias, thanks for the reference, but in my case its safe to use eval(). I use it to predefine a series of steps that have to be taken at deployment – Max Sep 30 '12 at 15:13

0 Answers0