Decimal comparisons

Kris Zyp kris at sitepen.com
Thu Sep 18 19:58:54 PDT 2008


>> * Like Crock, I prefer that typeof 1m === 'number'. However, unlike 
>> Crock's
>> and Brendan's agreement, I think this should be unconditional. I think it
>> would be horrible for 'typeof X' to depend not only on the value of X but
>> also on the mode of the program unit in which the typeof appears. Please
>> don't do that.

+1 for typeof 1m === 'number'. As an example of breakage, I believe 
Crockford's current version of his JSON library would not do as I would 
desire with decimals:

JSON.stringify({foo:1m}) -> "{\"foo\":undefined}"

I think there is a may be a lot of code that is dependent on typeof 
returning a one of exactly six possible values.
Kris 



More information about the Es-discuss mailing list