Evaluate string giving boolean expression in JavaScript
<p>I have a string that contains Boolean logic something like:</p>

<pre><code>var test = "(true)&amp;&amp;(false)&amp;&amp;!(true||true)"
</code></pre>

<p>What is a good way to evaluate this string in JavaScript to get the boolean value of false in this case</p>

<ol>
<li>I know we could use eval() or new Function().. - but is that a safe approach? </li>
<li>I am guessing the other option would be to write a custom parser. Being a fairly new person to JS, would that be a lot of effort? I could not find any examples of parsers for Boolean logic expressions</li>
<li>Any other alternatives?</li>
</ol>