Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

Adding properties/methods to a defined property?

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

Post a Comment

0 Comments