RegEx is part of the answer. Also use eval() to execute the argument string.
function myFunction() { return "Hello World!"; } console.log(eval("myFunction{}".replace(/\{\}/, '()')));