[parenscript-devel] Bug with ==

Henrik Hjelte henrik at evahjelte.com
Wed Mar 3 08:23:00 UTC 2010


On Tue, Mar 2, 2010 at 10:59 PM, Daniel Gackle <danielgackle at gmail.com> wrote:

> Perverse side note: the above example doesn't work if you assign 1 to the
> variables because in JS, the following is true:
>
> 1 == true
>
> I didn't know this. JS still manages to shock me sometimes.

That is why you always should use === instead of == in Javascript.

1 == true is true
1 === true is false

http://rayfd.wordpress.com/2007/03/18/really-understanding-javascripts-equality-and-identity/

/Henrik Hjelte




More information about the parenscript-devel mailing list