JPDev@programming.dev to Programmer Humor@programming.dev · 8 months ago===programming.devimagemessage-square66fedilinkarrow-up1629arrow-down117
arrow-up1612arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 8 months agomessage-square66fedilink
minus-squareButtons@programming.devlinkfedilinkEnglisharrow-up67arrow-down1·edit-28 months agohttps://programming.dev/post/7789832
minus-squareschnurrito@discuss.tchncs.delinkfedilinkarrow-up16·8 months agoby not ever using == and !=, but only === and !==
minus-squareByteJunk@lemmy.worldlinkfedilinkarrow-up3·8 months agoYep. It’s the only reason I’m still somewhat sane.
minus-squarefidodo@lemmy.worldlinkfedilinkEnglisharrow-up2·8 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-squareblackn1ght@feddit.uklinkfedilinkarrow-up9·8 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·8 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-squareJaddedFauceet@lemmy.worldlinkfedilinkarrow-up6·8 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·8 months agoAnd typescript is basically just a linter on steroids
https://programming.dev/post/7789832
deleted by creator
by not ever using == and !=, but only === and !==
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.
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()];
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
Ikr? English is hard /s