HiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-213 days agoWhy make it complicated?lemmy.mlimagemessage-square107fedilinkarrow-up11arrow-down10file-textcross-posted to: [email protected]
arrow-up11arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@programming.devEnglish · edit-213 days agomessage-square107fedilinkfile-textcross-posted to: [email protected]
minus-squaremasterspace@lemmy.calinkfedilinkEnglisharrow-up0·13 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-up0·13 days agoIf there’s only two options you only need one keyword
minus-squareHotzilla@sopuli.xyzlinkfedilinkarrow-up0·edit-213 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
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.