Hi,

I think it'd be nice to have the functions available in Math in
Number.prototype.
e.g.

Number.prototype.pow = function ( p ) {
    return Math.pow( this, p );
};

Since pow is supposed to be an operator, I feel better when writing
a.pow( b ) than Math.pow( a, b );

About the other methods, I'm not sure. They really are "functions" in
maths so it doesn't feel that weird calling them with Math.f( ).
Moreover if you store them in local variables.
But I still find doing a.abs( ).ceil( ) is way more convenient than
Math.ceil( Math.abs( a ) ).

So since numbers are litterals and therefore extending the prototype
won't break anything, why not add it?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to