« Re: Geocoder Help | Main | Another Problem with the Blog »

Java Script Closures

Hi,

during the time I spent with the Google Maps API I saw in a lot of examples the use of so called JS function closure. According to some sources this a powerful coding technique, but I actually don't see the advantages. As far as I understand the concept you just use a function as an argument for another function like GDownloadUrl("data.xml", function(data, responseCode) {
var xml = GXml.parse(data)
...
});

Could someone, or perhaps Bud in class, explain to me where the advantage of this coding style is? All I see is code that is very inconvenient to read :)

André

TrackBack

Listed below are links to weblogs that reference Java Script Closures:

» Response: Java Script Closures from Chidambaram's Blog
Responding to Andre's blog about javascript closures. From my understanding ....those are not just coding style. The one you mentioned GDownloadUrl("data.xml", function(data, responseCode) { var xml = GXml.parse(data) is passing an anonymous function a... [Read More]

Coding Mix

Web 2.0 Mix

Archives