I can write the following in ES5:
String.prototype.something=function(){
return this.split(' ').join('');
};
How do I do the same thing in ES6 using the new features?
I know that this is also a valid ES6. I want to know whether there's any other way of implementing such functions in ES6 which is shorter?
The above function is just an example.
String.prototype
in general?this
is provided by their lexical scope.