Some javascript libraries like jquery or prototype can chain methods like so

$('element').html('bla').show('fast');

I can't figure out how this is done, does anyone have a simplified example?

Thanks