Re: Cookie problem! Getting error when passing the expire date.
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Cookie problem! Getting error when passing the expire date.

From: Evertjan. <exjxw.hannivoort@interxnl.net>
Date: Sun Apr 30 2006 - 10:39:33 CEST

Dr John Stockton wrote on 29 apr 2006 in comp.lang.javascript:

> JRS: In article <Xns97B4759D23B5eejj99@194.109.133.242>, dated Sat, 29
> Apr 2006 09:33:41 remote, seen in news:comp.lang.javascript, Evertjan.
> <exjxw.hannivoort@interxnl.net> posted :
>>Dr John Stockton wrote on 28 apr 2006 in comp.lang.javascript:
>>
>>> Alternatively, X|0 seems to convert most things to a
>>> respectable Number.
>>>
>>
>>+X|0
>>
>>===========
>>
>>x='a'
>>y=+x|0
>>alert(y);
>>
>>x='5'
>>y=+x|0
>>alert(y);
>
> For me, the + makes no visible difference to those.

You are right.

Because a string, like a zero, equals false, when |-ing.

So if you want only NaN to default to 1, you are in trouble anyway:

x='3'
y=x|1
alert(y); // returns 3, correct

x='aString'
y=x|1
alert(y); // returns 1, correct

x='0'
y=x|1
alert(y); // returns 1,
          //"should" return 0, x being convertable to a number.

Not much of a zero tolerance!

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Received on Mon May 1 05:27:42 2006