@[email protected] to Programmer [email protected] • 8 days agoparseInt(5)lemmy.mlimagemessage-square63fedilinkarrow-up1474arrow-down16
arrow-up1468arrow-down1imageparseInt(5)lemmy.ml@[email protected] to Programmer [email protected] • 8 days agomessage-square63fedilink
minus-square@[email protected]linkfedilink34•8 days agoJavascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.
minus-square@[email protected]linkfedilinkEnglish-3•8 days agoTheoretically, Javascript is an untyped language, so there aren’t supposed to really be static types. Giving type errors in this situation would be against design.
minus-square@[email protected]linkfedilinkEnglish4•8 days agoLol you’ll get no argument from me. It’s not my favorite language.
minus-square@[email protected]linkfedilinkEnglish5•8 days agoJavaScript has types and it does have type errors, for instance > null.foo Uncaught TypeError: null has no properties Please stop spouting nonsense on issues you know nothing about.
minus-square@[email protected]linkfedilinkEnglish-2•8 days agoDynamic types aren’t static types my man. I think you got some learning to do.
minus-square@[email protected]linkfedilinkEnglish-1•8 days ago Theoretically, Javascript is an untyped language… Function only handles string arguments correctly. Wat.
minus-squareVictorlinkfedilink-3•edit-28 days agoBut you’re calling a function specifically made for passing a string to an int… 😆 There’s gotta be some common sense somewhere here, guys. Still, it’s a very good point. JS should do this. I would suspect one reason it doesn’t do this is to be backwards compatible.
minus-square@[email protected]linkfedilink1•8 days agoAnd god fucking forbid that common sense be in the language. Who the fuck needs a language with common sense, amirite?
Javascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.
Theoretically, Javascript is an untyped language, so there aren’t supposed to really be static types. Giving type errors in this situation would be against design.
Maybe the design is bad, then.
Lol you’ll get no argument from me. It’s not my favorite language.
JavaScript has types and it does have type errors, for instance
> null.foo Uncaught TypeError: null has no properties
Please stop spouting nonsense on issues you know nothing about.
Dynamic types aren’t static types my man. I think you got some learning to do.
You did say untyped though.
Lol like facilitate versus effectuate
Function only handles string arguments correctly. Wat.
But you’re calling a function specifically made for passing a string to an int… 😆 There’s gotta be some common sense somewhere here, guys.
Still, it’s a very good point. JS should do this.
I would suspect one reason it doesn’t do this is to be backwards compatible.
And god fucking forbid that common sense be in the language. Who the fuck needs a language with common sense, amirite?
🤪