Google Группы больше не поддерживают новые публикации и подписки в сети Usenet. Опубликованный ранее контент останется доступен.

evaluation of boolean OR in rhino

2 просмотра
Перейти к первому непрочитанному сообщению

steveH

не прочитано,
24 сент. 2005 г., 18:50:3024.09.2005
Hi, Rhino evaluates "test" || 1 as true, rather than 1. Is this a bug
or by design?

Martin Honnen

не прочитано,
25 сент. 2005 г., 07:51:5825.09.2005

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

не прочитано,
26 сент. 2005 г., 02:43:2926.09.2005
my mistake, of course it should be "test", not 1

0 новых сообщений