▲ 668 ▼ === (programming.dev) submitted 2 years ago by JPDev@programming.dev to c/programmer_humor@programming.dev 71 comments fedilink hide all child comments
[+] BaardFigur@lemmy.world 19 points 2 years ago (6 children) [deleted] permalink fedilink source parent hideshow 12 child comments replies: [–] schnurrito@discuss.tchncs.de 16 points 2 years ago by not ever using == and !=, but only === and !== permalink fedilink source parent [–] blackn1ght@feddit.uk 10 points 2 years ago (2 children) 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 new Date(2024, 0, 1) permalink fedilink source parent hideshow 4 child comments replies: [+] BaardFigur@lemmy.world 8 points 2 years ago* [deleted] permalink fedilink source parent [–] JaddedFauceet@lemmy.world 1 point 2 years ago 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()]; permalink fedilink source parent [–] FooBarrington@lemmy.world 10 points 2 years ago (1 child) Typescript :) permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 3 points 2 years ago (1 child) Yep. It's the only reason I'm still somewhat sane. permalink fedilink source parent hideshow 2 child comments replies: [–] fidodo@lemmy.world 2 points 2 years ago I got by without it for years, but not that I have it I have no idea how I did it back then. permalink fedilink source parent [–] darcy@sh.itjust.works 7 points 2 years ago (1 child) almost forced to for web front end. why you would use it anywhere else, however, i will never know permalink fedilink source parent hideshow 2 child comments replies: [–] Turun@feddit.de 4 points 2 years ago The same reason people drive their car to buy groceries. You bought it for something where it was the only option, driving 30km to work everyday. But ever since you got it, the trip to the super market is kinda too hot in the summer and too cold in the winter and what if you spontaneously need to buy more than expected? People learn it for front end dev, and then they use what they know for back end too. permalink fedilink source parent [–] JaddedFauceet@lemmy.world 7 points 2 years ago (1 child) 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/eqeqeq These rules often come with project starter template permalink fedilink source parent hideshow 2 child comments replies: [–] fidodo@lemmy.world 4 points 2 years ago And typescript is basically just a linter on steroids permalink fedilink source parent [–] FrostKing@lemmy.world 2 points 2 years ago* Ikr? English is hard /s permalink fedilink source parent
[–] schnurrito@discuss.tchncs.de 16 points 2 years ago by not ever using == and !=, but only === and !== permalink fedilink source parent
[–] blackn1ght@feddit.uk 10 points 2 years ago (2 children) 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 new Date(2024, 0, 1) permalink fedilink source parent hideshow 4 child comments replies: [+] BaardFigur@lemmy.world 8 points 2 years ago* [deleted] permalink fedilink source parent [–] JaddedFauceet@lemmy.world 1 point 2 years ago 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()]; permalink fedilink source parent
[–] JaddedFauceet@lemmy.world 1 point 2 years ago 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()]; permalink fedilink source parent
[–] FooBarrington@lemmy.world 10 points 2 years ago (1 child) Typescript :) permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 3 points 2 years ago (1 child) Yep. It's the only reason I'm still somewhat sane. permalink fedilink source parent hideshow 2 child comments replies: [–] fidodo@lemmy.world 2 points 2 years ago I got by without it for years, but not that I have it I have no idea how I did it back then. permalink fedilink source parent
[–] ByteJunk@lemmy.world 3 points 2 years ago (1 child) Yep. It's the only reason I'm still somewhat sane. permalink fedilink source parent hideshow 2 child comments replies: [–] fidodo@lemmy.world 2 points 2 years ago I got by without it for years, but not that I have it I have no idea how I did it back then. permalink fedilink source parent
[–] fidodo@lemmy.world 2 points 2 years ago I got by without it for years, but not that I have it I have no idea how I did it back then. permalink fedilink source parent
[–] darcy@sh.itjust.works 7 points 2 years ago (1 child) almost forced to for web front end. why you would use it anywhere else, however, i will never know permalink fedilink source parent hideshow 2 child comments replies: [–] Turun@feddit.de 4 points 2 years ago The same reason people drive their car to buy groceries. You bought it for something where it was the only option, driving 30km to work everyday. But ever since you got it, the trip to the super market is kinda too hot in the summer and too cold in the winter and what if you spontaneously need to buy more than expected? People learn it for front end dev, and then they use what they know for back end too. permalink fedilink source parent
[–] Turun@feddit.de 4 points 2 years ago The same reason people drive their car to buy groceries. You bought it for something where it was the only option, driving 30km to work everyday. But ever since you got it, the trip to the super market is kinda too hot in the summer and too cold in the winter and what if you spontaneously need to buy more than expected? People learn it for front end dev, and then they use what they know for back end too. permalink fedilink source parent
[–] JaddedFauceet@lemmy.world 7 points 2 years ago (1 child) 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/eqeqeq These rules often come with project starter template permalink fedilink source parent hideshow 2 child comments replies: [–] fidodo@lemmy.world 4 points 2 years ago And typescript is basically just a linter on steroids permalink fedilink source parent
[–] fidodo@lemmy.world 4 points 2 years ago And typescript is basically just a linter on steroids permalink fedilink source parent
[–] FrostKing@lemmy.world 2 points 2 years ago* Ikr? English is hard /s permalink fedilink source parent