Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

evaluation of boolean OR in rhino

2 Aufrufe
Direkt zur ersten ungelesenen Nachricht

steveH

ungelesen,
24.09.2005, 18:50:3024.09.05
an
Hi, Rhino evaluates "test" || 1 as true, rather than 1. Is this a bug
or by design?

Martin Honnen

ungelesen,
25.09.2005, 07:51:5825.09.05
an

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

ungelesen,
26.09.2005, 02:43:2926.09.05
an
my mistake, of course it should be "test", not 1

0 neue Nachrichten