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: Michael Winter <m.winter@blueyonder.co.uk>
Date: Sun Apr 30 2006 - 22:45:50 CEST

On 30/04/2006 20:51, VK wrote:

> Lasse Reichstein Nielsen wrote:
>
>> I guess it's a matter of definition whether "" represents a number
>> (that would be 0 then) or not. The "Number" function appears to
>> think it does.
>
> Not the Number only, but the whole language itself, welcome to the
> JavaScript world. Are we aware of runtime typezation? ;-)

Do you mean implicit type conversion, or the status of ECMAScript as a
dynamically-typed language?

> alert("" == 0); // true

The above is a product of the former.

When strings are compared to numbers, the string is type-converted to a
number. In fact, type conversion, in general, is typically biased
towards numbers. Probably because, as far as comparison is concerned, a
number is the most simple and efficient.

> btw and AFAIK Number is supposed to be used as constructor, not as a
> method.

Not really. All of the constructor functions that are analogous to
primitive types (String, Boolean, and Number), and the Object
constructor function, perform type conversion when called as functions.
The other constructor functions typically act as though they were called
with use of the new operator (though Date is an odd exception).

The Number and Boolean constructor functions are typically less
efficient than the equivalent operator sequences (unary plus [+] and
logical NOT [!], respectively).

Mike

-- 
Michael Winter
Prefix subject with [News] before replying by e-mail.
Received on Mon May 1 05:28:12 2006