How to execute script from an Input field on JS?
<p>I want to execute script from an editable input field when clicking a button</p>

<p>for example, If you type "<em>alert("x");</em>", I want to alert you "x", but also if you type "<em>for(i=0;i&lt;3;i++){alert(i);}</em>" I want it to execute it.</p>

<p>How can I achieve this?</p>

<blockquote>
  <p><strong>Edit:</strong> eval() is the only solution? Because I read that it is dangerous:
  <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/eval#section_5" rel="nofollow">https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/eval#section_5</a></p>
</blockquote>
