DEV Community

Discussion on: Pragmatic types: is JavaScript an untyped language?

Collapse
 
tux0r profile image
tux0r

Coercion is what is wrong with JavaScript's non-type system IMO. It is the source of too many problems, including security-related ones.

Collapse
 
shalvah profile image
Shalvah • Edited

Yeah, I think one of the greatest errors in the language's design was choosing to make invalid math operations return NaN rather than throw an exception. Nine times out of ten, programmers don't intend to multiply 3 by "five", so why not fail immediately and loudly?

Collapse
 
stereobooster profile image
stereobooster

Yes in JS coercion rules are pretty nasty