Closed tintin10q closed 1 year ago
I do enjoy this syntax in Python, but JavaScript, as yet, does not have operator overloading at all. And this proposal is not the place it will be introduced, if it ever is; that would be a separate proposal. You might wish to follow along at https://github.com/tc39/proposal-operator-overloading.
Python has this great infix shorthands for the set operations which are quite elegant. For instance, - 2 sets you get a new set with the difference.
The minus operator should be a nice and elegant shortcut for the
.difference
operator.Example from the python docs
So
-
for difference,|
for union,&
for intersection and^
for symmetric difference.