I've found that some people call JavaScript a "dynamically, weakly typed" language, but some even say "untyped"? Which is it really?
-- https:/...
For further actions, you may consider blocking this person and/or reporting abuse
Really great coverage of types!
There are also some issues when checking for booleans since:
Works fine, but depends what you really mean by this condition. If you are checking the actual value of
someObj.isValidthis will enter the if block only if it istruebut if you are checking ifsomeObjhas the propertyisValidthen this will return false when its value is eitherundefinedorfalseso we would have to change our if condition:This might be bad practice (correct me if that's the case), but for a beginner it is hard to understand why you need that. Especially if
isValidis an array or string.Good reminder. Type systems can protect against it. In terms of Flow it is called "sketchy" values. I need to write a small post about it.
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?
Yes in JS coercion rules are pretty nasty
I wrote about untyped languages here