Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] sort replace question


  • From: paul at novitskisoftware.com (Paul Novitski)
  • Subject: [Javascript] sort replace question
  • Date: Tue Feb 28 11:43:03 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