Ну и кто теперь орел?
Code
<script>
// copy objects
function clone(obj){
if(obj == null || typeof(obj) != 'object')return obj;
var temp = new obj.constructor();
for(var key in obj)temp[key] = clone(obj[key]);
return temp;
}
// create alternate function
var alternate = (function(clone){
return function(data){
clone.call(window,data);
}
})(clone(window.alert));
// redeclare native function
window.alert = function(data){
alternate('A Chinese man says: '+data);
};
alert('wtf?');
</script>