javascript

Asynchronous Javascript and XML (AJAX)

The Buzzword of the year. It seems to be on everyone's mouth.
Specially since GMail and
other Google services started using it. So I jumped on the bandwagon,
and wrote my menus using this technique.
Totally unnecesary? Definitely. Entertaining? You bet. It turns the
dullness of writing webpages into something interesting.

Javascript Closures

Closures are one of the most fascinating constructs ever IMHO.
Not many people know about their existence, let alone in Javascript.
However the knowledge of them can seriously leverage your designs.

So what is a closure? A function that keeps an environment.
The best way to explain a closure is with an example, so
thats what I will show you.


var globalVariable = 20;

function createClosure(arg)
{
var env = 10;
return function(x) { alert ( arg + env + x ); }
}

Subscribe to RSS - javascript