K
k0t1k
Sorry if I am kicking the dead horse, but why null == undefined in
Rhino? This is what I got running Rhino shell.
$ java -jar js.jar
Rhino 1.6 release 1 2004 11 30
js> null == undefined
true
js> var a;
js> var b = null;
js> a == b
true
js> "" + a
undefined
js> "" + b
null
js>
Obviously Rhino knows the difference between two. I run into this
problem while trying to figure out way to distinguish situation when
object does not have a member with given name from situation when
object does have a member, but its value is null.
targetObject[ memberName ] != undefined
did not work
( "" + targetObject[ memberName ] ) != ( "undefined" )
does work, but looks ugly.
Any suggestions, insights, will be highly appreciated.
Andrei Tchijov
Rhino? This is what I got running Rhino shell.
$ java -jar js.jar
Rhino 1.6 release 1 2004 11 30
js> null == undefined
true
js> var a;
js> var b = null;
js> a == b
true
js> "" + a
undefined
js> "" + b
null
js>
Obviously Rhino knows the difference between two. I run into this
problem while trying to figure out way to distinguish situation when
object does not have a member with given name from situation when
object does have a member, but its value is null.
targetObject[ memberName ] != undefined
did not work
( "" + targetObject[ memberName ] ) != ( "undefined" )
does work, but looks ugly.
Any suggestions, insights, will be highly appreciated.
Andrei Tchijov