HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · 8 months agoWhy make it complicated?lemmy.mlimagemessage-square72linkfedilinkarrow-up1266arrow-down134file-text
arrow-up1232arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · 8 months agomessage-square72linkfedilinkfile-text
minus-squareGreatRam@lemmy.worldlinkfedilinkarrow-up41arrow-down5·8 months agoYou’re encoding more information in the typescript one. You’re saying it’s a string that will get updated.
minus-squaremasterspace@lemmy.calinkfedilinkEnglisharrow-up25arrow-down1·8 months agoYeah, it’s explicitly distinct from const a: String which says it won’t change, and var a: String, which means this is legacy code that needs fixing.
minus-squarePsaldorn@lemmy.worldlinkfedilinkarrow-up6·8 months agoIf there’s only two options you only need one keyword
minus-squareLemminary@lemmy.worldlinkfedilinkarrow-up1·8 months agoAh, but this is JS, so there are three options! And they all function entirely differently. And your assumptions don’t apply, either. :D
minus-squareScoopta@programming.devlinkfedilinkarrow-up14arrow-down2·8 months agoYou aren’t though. In most languages that use the latter declaration you would prefix the declaration with final or const or the like to specify it won’t be updated.
minus-squareZiglin (it/they)@lemmy.worldlinkfedilinkEnglisharrow-up1·8 months agoMeanwhile if it’s rust it’s the opposite. (Variables that can change must specify that they are mutable)
You’re encoding more information in the typescript one. You’re saying it’s a string that will get updated.
Yeah, it’s explicitly distinct from
const a: Stringwhich says it won’t change, andvar a: String, which means this is legacy code that needs fixing.If there’s only two options you only need one keyword
Ah, but this is JS, so there are three options! And they all function entirely differently. And your assumptions don’t apply, either. :D
You aren’t though. In most languages that use the latter declaration you would prefix the declaration with final or const or the like to specify it won’t be updated.
deleted by creator
Meanwhile if it’s rust it’s the opposite. (Variables that can change must specify that they are mutable)