2 ms·
> JS is a strongly typed Strongly typed implies no implicit coersions at runtime. Python is strongly typed. JS or PHP are weakly typed.
by throwaway487549 8y ago
> JS is a strongly typed
Strongly typed implies no implicit coersions at runtime. Python is strongly typed. JS or PHP are weakly typed.
- still_grokking 8y agoThat's wrong. What's about this Python code: 1.0 + 1 Or this Scala Code: "1".toFloat + "1".toInt In both cases that's clearly implicit type coercion at runtime. So according to the above constraint there would hardly be any strongly typed languages… (But quite the opposite is true in fact). Weakly typed means you can hose the type-system somehow and then perform some "illegal" or completely nonsensical operation. For example that's easy in C, but not possible in JS. In a strongly typed language any value has some precise type at any time. This is true for JS so it's strongly typed.