* Implementation: 1 

```
Function.prototype.method = function (name,func){
    this.prototype[name] = func;
     return this;
};    

String.method('trim', function(){
    return this.replace(/^\s+|\s+$/g, '');
});  

```
* Implementation: 2 

```
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, '');          
}  

```

Is there any difference between 1 and 2? except that 1 can be applied to all objects and 2nd is only limited to String objects.