For example - using closures:
<script id="source" type="text/javascript">
function wrapString(str) {
return "(" + str + ")";
}
document.write = function(w) {
return function(s) {
w.call(this, wrapString(s));
}
}(document.write);
document.write("Hello");
document.write("world");
</script>
This "advanced piece of engineering" prints string: (Hello)(world)
How do you like it?