If I have a property created with Object.defineProperty where I want the getter to return a string, is it possible to attach methods to that string without screwing with the global String.prototype and without accidentally converting it to a generic object?
I know that sounds kind of wonky... think of it like how Element.classList works. Where Element.classList returns and array, but that array has extra properties like add/remove/toggle.
Or even just Number where it behaves as a number...
Adding properties/methods to a defined property?
from JavaScript https://ift.tt/2lTVkkl
via IFTTT

0 Comments