Re: what is the purpose of '(' in eval
- --- In email@example.com, "Douglas Crockford" <douglas@...> wrote:
> > I have been looking at JSON, and have seen in a few places where
> > eval statement is writtenOK. Thanks
> > x = eval('(' + var + ')');
> > what is the purpose of the '(' and ')'
> can be interpreted as either a block statement or an object literal.
> The parens disambiguate.
Could you give a simple example where this would fail? Would help to