- From: Cameron McCormack <cam@mcc.id.au>
- Date: Mon, 9 Jul 2007 20:52:01 +1000
- To: public-html <public-html@w3.org>
Maciej Stachowiak: > This is why for ECMAScript arrays, 0, 0.0, .0 and "0" all work as > numeric subscripts for the built-in Array type, but "0.0" and ".0" do > not. > > javascript:alert(["a"][0]) -> a > javascript:alert(["a"]["0"]) -> a > javascript:alert(["a"][0.0]) -> a > javascript:alert(["a"]["0.0"]) -> undefined > javascript:alert(["a"][.0]) -> a > javascript:alert(["a"][".0"]) -> undefined > > The model here is that numeric values get converted to string and then > string-compared with the appropriate string represetnation of an > integer, so it does not matter how they are spelled. But strings > undergo no conversion. That’s a subtelty I missed, thanks… -- Cameron McCormack, http://mcc.id.au/ xmpp:heycam@jabber.org ▪ ICQ 26955922 ▪ MSN cam@mcc.id.au
Received on Monday, 9 July 2007 10:52:09 UTC