4 ms·
Pretty sure javascript is weakly typed.
by Guthur 8y ago
Pretty sure javascript is weakly typed.
- tom_mellior 8y agoCan you show an example of a JavaScript type error that is not detected at any point? By "type error" I mean something like "applying integer add to a bit pattern representing an integer and a bit pattern representing a float", which you can do in assembly language or Forth or C, but not in any dynamically typed language I know of. Because you cannot take the bits that make up a float and pretend to the compiler that those bits actually represent an integer.
- gugagore 8y agoI have heard that languages like javascript are weakly typed because of the effort they go through to evaluate an expression instead of throwing a type error. >> "5" - 3 < 2 It doesn't fit your example of a type error. Quite the opposite, the interpreter intentionally has code to do the specific thing for the specific types. But this feature is why javascript is "weakly typed" in many posts.
- leshow 8y agoweak/strong typing has no formal definition. You can argue over it's meaning but neither of you will be right.
- deleted 8y ago[deleted]