OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 23 hours agoparseInt(5)lemmy.mlimagemessage-square59linkfedilinkarrow-up1434arrow-down15
arrow-up1429arrow-down1imageparseInt(5)lemmy.mlOsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 23 hours agomessage-square59linkfedilink
minus-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up37arrow-down3·21 hours agoJavascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.
minus-squareVictor@lemmy.worldlinkfedilinkarrow-up3arrow-down6·edit-218 hours 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-squarelistless@lemmy.cringecollective.iocakelinkfedilinkarrow-up2·9 hours agoAnd god fucking forbid that common sense be in the language. Who the fuck needs a language with common sense, amirite?
minus-squareheavy@sh.itjust.workslinkfedilinkEnglisharrow-up4arrow-down7·20 hours 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-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up27arrow-down1·20 hours agoMaybe the design is bad, then.
minus-squareheavy@sh.itjust.workslinkfedilinkEnglisharrow-up5·19 hours agoLol you’ll get no argument from me. It’s not my favorite language.
minus-squarebleistift2@sopuli.xyzlinkfedilinkEnglisharrow-up6arrow-down1·16 hours 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-squareheavy@sh.itjust.workslinkfedilinkEnglisharrow-up1arrow-down4·16 hours agoDynamic types aren’t static types my man. I think you got some learning to do.
minus-squareheavy@sh.itjust.workslinkfedilinkEnglisharrow-up1·5 hours agoLol like facilitate versus effectuate
minus-squarezqwzzle@lemmy.calinkfedilinkEnglisharrow-up1arrow-down3·18 hours ago Theoretically, Javascript is an untyped language… Function only handles string arguments correctly. Wat.
Javascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.
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?
🤪
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.