var s = 'alert(1);var a = 2\nif(a)alert(a)'; alert(new Function('', s).toString().replace(/(^function anonymous\(\) \{\n|\n\}$)/g, ''));