[Javascript] sort replace question

Paul Novitski paul at novitskisoftware.com
Tue Feb 28 11:09:05 CST 2006


At 08:37 AM 2/28/2006, Michael Borchers wrote:
>  var y = 3.5;
>  var x = parseFloat(y);
>
>  var z = toString(y);
>  alert(z);
>
>gives out: [object Window]

At 08:42 AM 2/28/2006, Matt Barton wrote:
>var y = 3.5;
>var x = parseFloat(y);
>
>var z = y.toString();
>alert(z);


1) Don't you mean:

         var z = x.toString();

so that you're converting the cleaned-up value (x) instead of the 
original value (y)?


2) Because this thread is "sort replace question" I'm wondering: why 
are you converting to string before sorting?  Isn't your sort of 
floating-point numbers working correctly?

Paul 




More information about the Javascript mailing list