Function( confusion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BigDave

    Function( confusion

    Hi,

    I'm a C++ programmer attempting to learn some basics of Javascript.

    The following line is confusing me...

    GDownloadUrl("/test.aspx", function(xmlDat a, responseCode)

    .... with respect to the 2nd parameter in the method -
    'function(xmlDa ta'

    What does this syntax mean exactly? I presume it means some thing of
    an xmlData type, but being a C programmer, I'm not used to open
    brackets '(' without a closing one!

    If you could pass me a link to a Javascript reference that explains
    this, that would be useful.

    Thanks
  • BigDave

    #2
    Re: Function( confusion

    I think I have solved it. It's some dodgy code...

    The person who wrote it put a huge function in the GDownloadUrl call

    something like

    GDownloadUrl("u rl", function(param1 , param2) {

    hundred or so lines of code...
    }
    );

    Which really confused me!

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: Function( confusion

      BigDave wrote:
      I think I have solved it. It's some dodgy code...
      There is nothing dodgy about it.
      The person who wrote it put a huge function in the GDownloadUrl call
      >
      something like
      >
      GDownloadUrl("u rl", function(param1 , param2) {
      >
      hundred or so lines of code...
      }
      );
      >
      Which really confused me!
      In ECMAScript implementations like in functional programming languages,
      functions are first-class objects, and so may appear right-hand side of an
      assignment and be used as function/method arguments. function(...) { ... }
      is a function expression, and the resulting Function object is used as a
      callback here. RTFM.


      PointedEars
      --
      Use any version of Microsoft Frontpage to create your site.
      (This won't prevent people from viewing your source, but no one
      will want to steal it.)
      -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

      Comment

      • BigDave

        #4
        Re: Function( confusion

        On 2 Nov, 16:16, Thomas 'PointedEars' Lahn <PointedE...@we b.dewrote:
        BigDave wrote:
        I think I have solved it. It's some dodgy code...
        >
        There is nothing dodgy about it.
        >
        The person who wrote it put a huge function in the GDownloadUrl call
        >
        something like
        >
        GDownloadUrl("u rl", function(param1 , param2) {
        >
        hundred or so lines of code...
        }
        );
        >
        Which really confused me!
        >
        In ECMAScript implementations like in functional programming languages,
        functions are first-class objects, and so may appear right-hand side of an
        assignment and be used as function/method arguments.  function(...) { .... }
        is a function expression, and the resulting Function object is used as a
        callback here.  RTFM.
        >
        PointedEars
        --
        Use any version of Microsoft Frontpage to create your site.
        (This won't prevent people from viewing your source, but no one
        will want to steal it.)
          -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
        The term 'dodgy code' was perhaps wrong, what I meant to say was it
        could have been laid out better, but 'dodgy code' was the first term
        that came to mind.

        And you won't make any friends using terms like RTFM.




        Comment

        • BigDave

          #5
          Re: Function( confusion

          Ahh I see. I've read some of your previous messages. Consider yourself
          erased from my personal universe *plonk*

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Function( confusion

            BigDave wrote:
            Ahh I see. I've read some of your previous messages. Consider yourself
            erased from my personal universe *plonk*
            Given that Google Groups, which you are using, has no killfile feature yet
            (or has it now?), I find that statement rather hilarious.

            Rest assured I couldn't care less about the humble opinion about me of an
            obviously incompetent anonymous googlodyte formed after the cause of their
            misconceptions has been kindly explained to them although quick self-study
            by themselves could have revealed it already, and reading some of my newer
            proportionate responses to postings of equally clueless script-kiddies.


            PointedEars
            --
            Use any version of Microsoft Frontpage to create your site.
            (This won't prevent people from viewing your source, but no one
            will want to steal it.)
            -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

            Comment

            • Evertjan.

              #7
              Re: Function( confusion

              BigDave wrote on 02 nov 2008 in comp.lang.javas cript:
              Ahh I see. I've read some of your previous messages. Consider yourself
              erased from my personal universe *plonk*
              Who ware youn referring to, usenet is not email?

              [please always quote on usenet]

              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • RobG

                #8
                Re: Function( confusion

                On Nov 3, 3:19 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                wrote:
                BigDave wrote:
                Ahh I see. I've read some of your previous messages. Consider yourself
                erased from my personal universe *plonk*
                >
                Given that Google Groups, which you are using, has no killfile feature yet
                (or has it now?), I find that statement rather hilarious.
                There are add-ons, such as Google Groups KillFile, that work wtih
                Greasemonkey to do just that. Perhaps you should take your own advice
                and do some research before posting opinion.

                Rest assured I couldn't care less about the humble opinion...
                Good to see the feeling is mutual.


                --
                Rob

                Comment

                • Jorge

                  #9
                  Re: Function( confusion

                  On Nov 3, 2:11 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                  wrote:
                  (...)
                  or be counted as just another googlodyte from this point forward.
                  (...)
                  You feel like a member of the upper class just because you use a
                  newsreader instead of Google Groups.
                  If that's really making you feel any better, you ought to tell the
                  doctor... :-)

                  I, for one, left using newsreaders (MacSoup) more a decade ago, and
                  don't feel any worse.

                  --
                  Jorge.

                  Comment

                  Working...