I vote for operator overloading!

I think this is probably going to be a good way to do it:
```
//in local scope
let operator(**) = (lhs,rhs) => Math.pow(lhs,rhs);

//class method
Complex.prototype.operator(+) = function(lhs,rhs){
  return new Complex(lhs.r+rhs.r,lhs.i+rhs.i);
}

//global, may not be an good idea
operator(+) = (lhs,rhs) => lhs*rhs;
```
//this will work for case above
names.sort(>)
```
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to