Closed Bug 745861 Opened 12 years ago Closed 12 years ago

null >= 0 is TRUE

Categories

(Firefox :: Untriaged, defect)

11 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: dkived, Unassigned)

Details

Attachments

(1 file)

Attached image js-null-bug.png
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0
Build ID: 20120310010316

Steps to reproduce:

While debugging an issue in some of my JS code, I found an odd behavior when performing tests on a null value. Apparently null values are not equal to zero, and are not greater than zero, yet somehow ARE greater than or equal to zero.

The problem first presented itself in my JS code; I investigated further using Firebug.


Actual results:

null == 0
(false)
null > 0
(false)
null >= 0
(true !!!!!!)


Expected results:

null == 0
(false)
null > 0
(false)
null >= 0
(false)
Forgot to mention, but this also applies to 'null <= 0'.
Bugzilla is not there to answer questions.
A good start is it to compare different Javascript Engines in the differen browsers  (IE, Opera, webkit, gecko)
Different results in different Engines are usually a bug and filing a bug in that case is good idea.

http://stackoverflow.com/questions/2910495/why-null-0-but-not-null-0 should explain this is no bug.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: