2 ms·
Operator Overloading in JavaScript (Proposal)
- zzo38computer 7y agoI had a different idea, called UserPrimitive, which allows operator overloading (with some restrictions) on user primitives, but not on objects. The UserPrimitive function takes an object listing the implementation and then returns another function, whose name is a fresh symbol (returned if typeof is used); you can then make your own function to call that returned function to create a user primitive value.