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

Re: [JavaScript] object oriented javascript quiz

Expand Messages
  • Jonas Raoni
    ... Sure :) ... 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); ... This
    Message 1 of 10 , Oct 31, 2006
      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
    • khing2
      ... thing ... First of all it would be nice if you would follow your comments with some useful information. I must thank you for point out the eval. Although
      Message 2 of 10 , Nov 10, 2006
        --- In JavaScript_Official@yahoogroups.com, "Jonas Raoni"
        <jonasraoni@...> wrote:
        >
        > On 10/26/06, Jayasurian <jayasurian123@...> wrote:
        > > i didnt get . whats the problem with "eval"? can we use any other
        thing
        > > instead of eval??
        > >
        > > can you explain?
        >
        > "eval" is quite slow and for me it's just a synonym for lack of
        > knowledge in the language, it has a specific use which is *parse
        > javascript code*.
        >
        > A good analogy can be: it doesn't make sense to program in pascal and
        > inside your code insert a eval("pascal code"), since you could do it
        > with the language itself.
        >
        > Well, if you doubt, try to show me a small code snippet where you
        > can't remove the "eval". It's acceptable only if your user can insert
        > code.
        >
        >
        > --
        > Jonas Raoni Soares Silva
        > http://www.jsfromhell.com
        >

        First of all it would be nice if you would follow your comments with
        some useful information. I must thank you for point out the eval.
        Although you are not correct about the use of eval i did notice that
        my use of the eval in that situation was not necessary.

        The script will work the very same way if you removed the eval and
        left the statements in place.

        when asked to explain what you should have said was this....

        There is no need to eval the element of the array which is the result
        of the paramater expressions in the eval statement because, The
        element in the array os already a valid pointer to the object.

        Lastly saying that its all badly written code.....It would be nice if
        you would provide a more useful response other than your
        sensationalism. Its easy for someone to say that this is crap! Ask
        them to say how it is crap and they get quiet.

        I pose a challenge to you to write an app with the very same
        functionality without the badly written code and post it here for us
        to compare.
      • Jonas Raoni
        ... I don t even remember of this code anymore, if I m not wrong it was something related with questions and answers , am I right? :D ... I didn t knew this
        Message 3 of 10 , Nov 11, 2006
          On 11/10/06, khing2 <khing2@...> wrote:
          > Lastly saying that its all badly written code.....

          I don't even remember of this code anymore, if I'm not wrong it was
          something related with "questions and answers", am I right? :D

          > It would be nice if
          > you would provide a more useful response other than your
          > sensationalism. Its easy for someone to say that this is crap! Ask
          > them to say how it is crap and they get quiet.

          I didn't knew this code was posted by a forum member, otherwise I
          would just stay quiet...

          But I remember that it was written something like "if you want to know
          more about very advanced OO techniques in javascript, follow this
          link", I don't like such phrases, they are so full of ego, so when I
          see such things, I check if the code is really what people claims it
          to be, if not, I say it's crap xD

          > I pose a challenge to you to write an app with the very same
          > functionality without the badly written code and post it here for us
          > to compare.

          Right now I don't have so much free time, but if you post a better
          challenge, I accept, I like to make things related with math or
          strings maniputation, something small and generic.


          --
          Jonas Raoni Soares Silva
          http://www.jsfromhell.com
        • khing2
          ... You must atleast read a post properly before you comment on it. the original post said this. To be honest at first glance you seem like a hot head script
          Message 4 of 10 , Nov 12, 2006
            --- In JavaScript_Official@yahoogroups.com, "Jonas Raoni"
            <jonasraoni@...> wrote:
            >
            > On 11/10/06, khing2 <khing2@...> wrote:
            > > Lastly saying that its all badly written code.....
            >
            > I don't even remember of this code anymore, if I'm not wrong it was
            > something related with "questions and answers", am I right? :D
            >
            > > It would be nice if
            > > you would provide a more useful response other than your
            > > sensationalism. Its easy for someone to say that this is crap! Ask
            > > them to say how it is crap and they get quiet.
            >
            > I didn't knew this code was posted by a forum member, otherwise I
            > would just stay quiet...
            >
            > But I remember that it was written something like "if you want to know
            > more about very advanced OO techniques in javascript, follow this
            > link", I don't like such phrases, they are so full of ego, so when I
            > see such things, I check if the code is really what people claims it
            > to be, if not, I say it's crap xD
            >
            > > I pose a challenge to you to write an app with the very same
            > > functionality without the badly written code and post it here for us
            > > to compare.
            >
            > Right now I don't have so much free time, but if you post a better
            > challenge, I accept, I like to make things related with math or
            > strings maniputation, something small and generic.
            >
            >
            > --
            > Jonas Raoni Soares Silva
            > http://www.jsfromhell.com
            >


            You must atleast read a post properly before you comment on it. the
            original post said this. To be honest at first glance you seem like a
            hot head script kiddy who feels he is the best coder out
            there......but i will give you the benefit of a doubt.

            It makes use of many useful key
            concepts that can be used in other advanced javascript applications.

            There is nothing egotistical about that.

            If you want to show people advanced stuff you must present it in
            simple form. That is all i was seeking to do. The javascript was
            written specifically to someone's specification. After it was done i
            thought it might be useful to someone wanting to get into object
            oriented javascript.
          • Jonas Raoni
            ... Most of the times it isn t needed, and when the post is big enough, I just don t read :) ... Haha, I don t have a hot head , I used to be a troll and I
            Message 5 of 10 , Nov 12, 2006
              On 11/12/06, khing2 <khing2@...> wrote:
              > You must at least read a post properly before you comment on it. the
              > original post said this.

              Most of the times it isn't needed, and when the post is big enough, I
              just don't read :)

              > To be honest at first glance you seem like a
              > hot head script kiddy who feels he is the best coder out
              > there......but i will give you the benefit of a doubt.

              Haha, I don't have a "hot head", I used to be a troll and I still
              keeping some of my old qualities, but now I just attack people who
              tries to show they have a superior knowledge in a bad way. If it
              wasn't your intention, sorry xD

              > If you want to show people advanced stuff you must present it in
              > simple form.

              If you want them to understand easily, it's true.

              > After it was done i thought it might be useful to someone wanting to get into object
              > oriented javascript.

              Have you seen that old JavaScript manual from devedge? There was a
              rich set of examples on it, for a beginner it would be much more
              cleaner, easier and more helpful to post it instead of your code (it
              used to explain how to do inheritance and each step was detailed),
              which has errors and don't present a really good way of doing things,
              a "example" should be simple, but not wrong :)

              Don't be angry, the world is already full of rage hahaha xD


              --
              Jonas Raoni Soares Silva
              http://www.jsfromhell.com
            Your message has been successfully submitted and would be delivered to recipients shortly.