HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-21 day agoWhy make it complicated?lemmy.mlimagemessage-square96fedilinkarrow-up1309arrow-down126file-textcross-posted to: programmerhumor@lemmy.ml
arrow-up1283arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-21 day agomessage-square96fedilinkfile-textcross-posted to: programmerhumor@lemmy.ml
minus-squaremasterspace@lemmy.calinkfedilinkEnglisharrow-up31arrow-down1·1 day 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-up8·1 day agoIf there’s only two options you only need one keyword
minus-squareHotzilla@sopuli.xyzlinkfedilinkarrow-up3·edit-218 hours 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
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.