OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 1 month agoparseInt(5)imagemessage-square20linkfedilinkarrow-up15arrow-down10
arrow-up15arrow-down1imageparseInt(5)OsrsNeedsF2P@lemmy.ml to Programmer Humor@programming.dev · 1 month agomessage-square20linkfedilink
minus-squareVictor@lemmy.worldlinkfedilinkarrow-up1·1 month agoClassic people who don’t know how to code wat. Passing a number in place of a string argument because they don’t know what they’re doing.
minus-squarejjjalljs@ttrpg.networklinkfedilinkarrow-up0·1 month 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-up0·edit-21 month 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-squareheavy@sh.itjust.workslinkfedilinkEnglisharrow-up0·1 month 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-squarebleistift2@sopuli.xyzlinkfedilinkEnglisharrow-up0·1 month 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-up0arrow-down1·1 month agoDynamic types aren’t static types my man. I think you got some learning to do.
Another classic javascript wat
Classic people who don’t know how to code wat. Passing a number in place of a string argument because they don’t know what they’re doing.
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.
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.
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.