Ah, folly of untyped systems. Tbh this behaviour makes sense given the rules implemented within the language. Anything passed to parseInt is casted to string and then parsed.
Is it shitty behaviour - yes. Does it make sense in given the language implementation - yes.
With this reasoning, would you say everything that a computer does makes sense, because it always follows the implementation? Or am I missing something?
If anyone’s wondering why:
>> 0.000005 0.000005
>> 0.0000005 5e-7
Yup. parseInt is for strings.
Math.floor, Math.ceil, Math.round or Math.trunc are for numeric type “conversions” (cause its still a float)
Nah, it’s stupid either way.
“5e-7” is not an int to be parsed. Neither is “0.5”.
Ah, folly of untyped systems. Tbh this behaviour makes sense given the rules implemented within the language. Anything passed to parseInt is casted to string and then parsed.
Is it shitty behaviour - yes. Does it make sense in given the language implementation - yes.
With this reasoning, would you say everything that a computer does makes sense, because it always follows the implementation? Or am I missing something?
Bar space-level problem where radiation can randomly shift your bits, I think yes.