JPDev@programming.dev to Programmer Humor@programming.dev · 10 months ago===programming.devimagemessage-square31fedilinkarrow-up1561arrow-down116
arrow-up1545arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 10 months agomessage-square31fedilink
minus-squareschnurrito@discuss.tchncs.delinkfedilinkarrow-up14·10 months agoby not ever using == and !=, but only === and !==
minus-squareblackn1ght@feddit.uklinkfedilinkarrow-up9·10 months agoBecause in reality you’re not doing stupid stuff like that in the image. And using Typescript definitely helps. However I’m always annoyed that the month parameter when constructing a date object is 0 based. So 1st of Jan is new Date(2024, 0, 1)
minus-squareJaddedFauceet@lemmy.worldlinkfedilinkarrow-up1·10 months agoLooks confusing at first, but I found it nice for accessing a month array. const months = ["Jan", "Feb", ...]; months[0] === "Jan"; const label = months[date.getMonth()];
minus-squareByteJunk@lemmy.worldlinkfedilinkarrow-up3·10 months agoYep. It’s the only reason I’m still somewhat sane.
minus-squarefidodo@lemmy.worldlinkfedilinkEnglisharrow-up2·10 months agoI got by without it for years, but not that I have it I have no idea how I did it back then.
minus-squareJaddedFauceet@lemmy.worldlinkfedilinkarrow-up6·10 months agoBy banishing the bad part of the language with linter. For instance, standard eslint preset has rules that enforce usage of ===, https://eslint.org/docs/latest/rules/eqeqeq These rules often come with project starter template
minus-squarefidodo@lemmy.worldlinkfedilinkEnglisharrow-up3·10 months agoAnd typescript is basically just a linter on steroids
minus-squaredarcy@sh.itjust.workslinkfedilinkarrow-up4·10 months agoalmost forced to for web front end. why you would use it anywhere else, however, i will never know
deleted by creator
by not ever using == and !=, but only === and !==
Because in reality you’re not doing stupid stuff like that in the image. And using Typescript definitely helps.
However I’m always annoyed that the month parameter when constructing a date object is 0 based. So 1st of Jan is
deleted by creator
Looks confusing at first, but I found it nice for accessing a month array.
const months = ["Jan", "Feb", ...]; months[0] === "Jan"; const label = months[date.getMonth()];
Typescript :)
Yep. It’s the only reason I’m still somewhat sane.
I got by without it for years, but not that I have it I have no idea how I did it back then.
By banishing the bad part of the language with linter.
For instance, standard eslint preset has rules that enforce usage of
===
, https://eslint.org/docs/latest/rules/eqeqeqThese rules often come with project starter template
And typescript is basically just a linter on steroids
almost forced to for web front end. why you would use it anywhere else, however, i will never know
Ikr? English is hard /s