You can't overload operators (read similar questions).
Moreover, a dedicated method like mult
can be treated as a sign of good design (not only in Javascript), since changing the original operator behavior can confuse users (well, a rational number actually a good candidate for overloading).
You can change print
to toString
as user thg435 has suggested.
Going even further:
Rational.prototype = {
mult : ... ,
toString: ... ,
valueOf: function() { return this.nominator / this.denominator; }
};
this will enable the a * b
syntax (note: you don't operate on Rationals
any more, but rather on primitives).