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

14494Re: [JavaScript] object oriented javascript quiz

Expand Messages
  • Jonas Raoni
    Oct 31, 2006
    • 0 Attachment
      On 10/31/06, Jayasurian <jayasurian123@...> wrote:
      > You are saying i can remove all the eval statements.

      Sure :)

      > var i= "123";
      > eval(i)+1; //prints 124

      You don't need to do it, there are other methods like:

      var x = "123";

      alert(+i + 1);
      alert(parseInt(i) + 1);
      alert(parseFloat(i) + 1);

      > Another place where i use eval is appending some strings as integer.
      >
      > ex : strings[+eval(i)+] // someting like this

      This is strange. Aren't you talking about something like eval("form."
      + field + ".value")? Is yes, it's simple too:

      form[field].value


      --
      Jonas Raoni Soares Silva
      http://www.jsfromhell.com
    • Show all 10 messages in this topic