Convert a string to a function
<p>Total newbie question.
how do i get the following code to work.</p>

<pre><code>var f_str = "function test(msg) { alert(msg) }"
var f = eval(f_str)
f("hello")
</code></pre>

<p>The idea is to have the function test as a string, and be able to execute it as a function.
eval doesn't seem to work, and i have tried JSON.parse too, without luck..</p>
