As explained in the post "Javascript Classes", javascript objects inherits properties and methods from its prototype objects. Due to this behavior is possible to extend a native object by adding custom properties to its  prototype object.

In Javascript is available the "String" native object which wrap the "string" primitive data-type and provides a number of helper methods (charAt(), indexOf(), slice(), split(), replace(), ...).

Lets see how to extend this native object with the "paddingLeft" and "paddingRight" functionalities: More...