Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

evaluation of boolean OR in rhino

2 views
Skip to first unread message

steveH

unread,
Sep 24, 2005, 6:50:30 PM9/24/05
to
Hi, Rhino evaluates "test" || 1 as true, rather than 1. Is this a bug
or by design?

Martin Honnen

unread,
Sep 25, 2005, 7:51:58 AM9/25/05
to

steveH wrote:

> Rhino evaluates "test" || 1 as true, rather than 1.

I think the result of
"test" || 1
should be the value of the first operand, that is the string value
"test" as that when converted to a boolean value already gives true so
the or condition is already fullfilled.

With Rhino 1.6 R2 I get

Rhino 1.6 release 2 2005 09 19
js> "test" || 1
true

so

>Is this a bug

yes, it is a bug. I have filed it here:
<https://bugzilla.mozilla.org/show_bug.cgi?id=309957>


--

Martin Honnen
http://JavaScript.FAQTs.com/

steveH

unread,
Sep 26, 2005, 2:43:29 AM9/26/05
to
my mistake, of course it should be "test", not 1

0 new messages