[Info-vax] [OT] The wonders of Javascript...

hb end.of at inter.net
Tue Mar 3 12:22:26 EST 2015


On 03/03/2015 03:02 PM, Simon Clubley wrote:

> BTW, and IMHO, Javascript_not_  throwing an error when you reference a
> non-existent property in a maths operation (but instead silently setting
> the LHS of the assignment to a NaN) is absolutely insane. There is no
> reason why something like that would ever be valid code.

Maybe I already said it, I use Javascript, that's all. So I don't want 
to argue, but that's the way Javascript works. Referencing a 
non-existant member of an object returns an undefined value (which is a 
"primitive value") and an undefined value used in an arithmetic 
expression is converted to a NaN - because Javascript
"performs automatic type conversion as needed" as described in the 
specs. There are more (unexpected?) automatic conversions like that.

Conversion as needed is not unusual to readers of c.o.v:
$ write sys$output "true"+1



More information about the Info-vax mailing list