Loading ...
Sorry, an error occurred while loading the content.

Re: what is the purpose of '(' in eval

Expand Messages
  • geoffreyk00
    ... the ... OK. Thanks Could you give a simple example where this would fail? Would help to understand better
    Message 1 of 3 , Jun 25, 2006
    • 0 Attachment
      --- In json@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      > > I have been looking at JSON, and have seen in a few places where
      the
      > > eval statement is written
      > > x = eval('(' + var + ')');
      > >
      > > what is the purpose of the '(' and ')'
      >
      > In Javascript there is a potential syntactic ambiguity in which {...}
      > can be interpreted as either a block statement or an object literal.
      > The parens disambiguate.
      >
      OK. Thanks
      Could you give a simple example where this would fail? Would help to
      understand better
    Your message has been successfully submitted and would be delivered to recipients shortly.