Function( confusion

B

BigDave

Hi,

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

The following line is confusing me...

GDownloadUrl("/test.aspx", function(xmlData, responseCode)

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

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
 
B

BigDave

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("url", function(param1, param2) {

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

Which really confused me!
 
T

Thomas 'PointedEars' Lahn

BigDave said:
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("url", 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
 
B

BigDave

There is nothing dodgy about it.






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.
 
B

BigDave

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

Thomas 'PointedEars' Lahn

BigDave said:
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
 
E

Evertjan.

BigDave wrote on 02 nov 2008 in comp.lang.javascript:
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]
 
R

RobG

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.
 
T

Thomas 'PointedEars' Lahn

RobG said:
^^^^^^^^^^^^^^
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.

Do you know what a question is? And perhaps I don't really care what
würgarounds googlodytes need to use in order to get the illusion of proper
newsreader software either.

JFTR: Occasionally I have to use Google Groups for posting myself, and each
and every time I am amazed what a PITA posting with GG is as compared with
Thunderbird. The missing indication where a word-wrap occurs and the
missing preview feature being only some causes to give that impression.


PointedEars
 
R

RobG

Do you know what a question is?

Yes, can you recognise an answer to your question?

 And perhaps I don't really care what

Your attitude and carping about GG users shows that you do care. Your
comments show you are seriously prejudiced against GG users for no
good reason - the use of a news reader does not instantly make the
user conform to your posting rules, or the perfect netizen.

würgarounds googlodytes need to use in order to get the illusion of proper
newsreader software either.

Having admonished the OP for not doing research before posting, you
then post a provocative reply without taking your own advice doing a
simple search for "Google Groups Killfile".

If you really don't care, drop the attitude and off-topic comments.
 
T

Thomas 'PointedEars' Lahn

RobG said:
Yes, can you recognise an answer to your question?

I can see it, nevertheless it misses the point almost completely.
Your attitude and carping about GG users shows that you do care.

This isn't about "my newsreader is better than yours" but the attitude that
is created and supported by using a Web interface that gives the illusion of
Usenet as a Web forum and therefore of the behavior that tends to be
accepted there. Playing stupid is not accepted in Usenet, and particularly
not in technical newsgroups like this.
Having admonished the OP for not doing research before posting, you
then post a provocative reply without taking your own advice doing a
simple search for "Google Groups Killfile".

You miss the point.
If you really don't care, drop the attitude and off-topic comments.

You want to re-read the thread and compare the (im)proportionality of
responses, or be counted as just another googlodyte from this point forward.

Nuff said.


PointedEars
 
J

Jorge

(...)
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,137
Messages
2,570,802
Members
47,349
Latest member
eixataze

Latest Threads

Top