question about eval

Discussion in 'Javascript' started by yawnmoth, Mar 1, 2008.

  1. yawnmoth

    yawnmoth Guest

    <script>
    a = "zzz:\nalert(1)";

    eval(a);
    </script>

    Why does that work? This doesn't (not that I'd expect it to):

    <script>
    zzz:
    aert(1);
    </script>

    So why does the first script work when the second one doesn't?
     
    yawnmoth, Mar 1, 2008
    #1
    1. Advertising

  2. yawnmoth

    Krukow Guest

    On 1 Mar., 18:32, yawnmoth <> wrote:
    > <script>
    > a = "zzz:\nalert(1)";
    >
    > eval(a);
    > </script>
    >
    > Why does that work? This doesn't (not that I'd expect it to):
    >
    > <script>
    > zzz:
    > aert(1);
    > </script>
    >
    > So why does the first script work when the second one doesn't?


    Because you misspelled alert?
     
    Krukow, Mar 1, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Newton
    Replies:
    3
    Views:
    9,422
    Brock Allen
    Apr 4, 2005
  2. DataBinder.Eval and Eval.

    , Jun 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    550
    Karl Seguin [MVP]
    Jun 16, 2006
  3. Alex van der Spek

    eval('07') works, eval('08') fails, why?

    Alex van der Spek, Jan 8, 2009, in forum: Python
    Replies:
    6
    Views:
    1,461
    Bruno Desthuilliers
    Jan 8, 2009
  4. Liang Wang
    Replies:
    8
    Views:
    134
    Ben Morrow
    Feb 2, 2008
  5. Marc Girod

    to eval or not to eval?

    Marc Girod, Apr 19, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    161
    Marc Girod
    Apr 19, 2011
Loading...

Share This Page