To me this seems like no win. What do you need that for?
On Feb 2, 2008 5:20 PM, Sascha Leib <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> after I spent two days trying to find something like "Math.sign()" or
> similar in core JavaScript, I decided that quickly writing it myself
> would probably be smarter (in terms of time management at least ;-)
>
> Now, this is really pretty straightforward:
>
> > Number.prototype.sign = function() {
> > if(this<0){return -1}
> > else if(this>0){return 1}
> > else {return 0};
> > };
>
> But I somehow still can't believe that this is neither in JS nor in
> Prototype implemented...
>
> Now, did I just miss sth., or is it so rarely needed that nobody ever
> missed it - or do you think it should be added to Prototype?
>
> /sascha
>
> PS: Oddly, the "Math" class doesn't seem to like 'prototyping'. -
> well, "Number" is the better choice anyway...
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---