How to Add a Clone function to Function?

Posted in code with : javascript


1 Function.prototype.clone = function() {
2     var that = this;
3     var temp = function temporary() { return that.apply(this, arguments); };
4     for( key in this ) {
5         temp[key] = this[key];
6     }
7     return temp;
8 };