null false
but null true
Would you expect that? I didn't. Obviously . Time to look up all uses of = in my code...p.s. Is this too trivial to post here? Too specialized? I'm curious.
1–10 of 25 posts
null false
but null true
Would you expect that? I didn't. Obviously . Time to look up all uses of = in my code...p.s. Is this too trivial to post here? Too specialized? I'm curious.
(Note - I can't ever remember how to embed links properly in YC... is there a reference somewhere?)
javascript:alert('null 0: '+(null>0)+'\nnull null: '+(null>null)+'\nnull<=null: ' + (null<=null));
Interesting and not what I would have expected. I just confirmed it in Opera. Also, null You can use the following javascript link to confirm this: (Note - I can't ever remember how to embed links properly in YC... is there a reference somewhere?) javascript:alert('null 0: '+(null>0)+'\nnull null: '+(null>null)+'\nnull<=null: ' + (null<=null));
In Python:
>>> -1 % 3
2
In Javascript: >>> -1 % 3
-1Okay... I have another one. In Python: >>> -1 % 3 2 In Javascript: >>> -1 % 3 -1
function hello () {
return
{
value : 10
};
}window.alert (hello ().value);
It burps in FF and IE...
[Rhino book] > When null is used in a Boolean context, it converts to false. When used in a numeric context, it converts to 0. And when used in a string context, it converts to "null".