HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-22 days agoWhy make it complicated?lemmy.mlimagemessage-square115fedilinkarrow-up1362arrow-down137file-textcross-posted to: programmerhumor@lemmy.ml
arrow-up1325arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-22 days agomessage-square115fedilinkfile-textcross-posted to: programmerhumor@lemmy.ml
minus-squaremasterspace@lemmy.calinkfedilinkEnglisharrow-up34arrow-down1·2 days 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-up10·2 days agoIf there’s only two options you only need one keyword
minus-squareLemminary@lemmy.worldlinkfedilinkarrow-up1·7 hours 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-squareHotzilla@sopuli.xyzlinkfedilinkarrow-up5·edit-22 days agoTrue, but var and let are not same in js, so there is three. if(true) { var a = "dumdum" } console.log(a) Is valid and functioning javascript. With let it is not.
Yeah, it’s explicitly distinct from
const a: String
which 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
True, but var and let are not same in js, so there is three.
if(true) {
var a = "dumdum"
}
console.log(a)
Is valid and functioning javascript. With let it is not.