Dimitri Glazkov

Web and About

Javascript Makes Me Giddy

leave a comment »

I must be a simple man, ‘cuz things like this in Javascript make me slap my sides, and go Hot damn!



		function Context(base) {
			if (base) {
				var c = function(base) {
					this.base = base;
				}
				c.prototype = base;
				return new c(base);
			}
			return new function() {
				// standard context functions
				this.get = function() {};
				// ...
			}
		}

		// then
		var a = Context();
		// do things with "a"
		var b = Context(a);
		// "b" inherits "a" as context:
		// * changes to "a" make it to "b"
		// * changes to "b" don't make it to "a"
		var c = Context(b);
		// you get the picture ...

I don’t know what’s more exciting here, the “no-much-to-it-ness” or the “bang-for-buck-ness”, but every time I get to work with Javascript, I am excited about the actual process of crafting code.

Written by Dimitri Glazkov

August 12, 2007 at 1:11 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: