4 ms·
This is part of the language not just a an interface (though I'm not sure it is an interface, I think it is an object primitive). You wouldn't be able to write
by throwaway2016a 8y ago
This is part of the language not just a an interface (though I'm not sure it is an interface, I think it is an object primitive). You wouldn't be able to write this using plain Javascript. Which is why there are no polyfills for client-side code.
Incidentally, PHP does it a similar way to Python with so-called "magic methods" but I can see the benefit to doing it this way.