▲ 696 ▼ the hardest exam question (lemmy.ml) submitted 2 years ago by siriusmart@lemmy.ml to c/programmerhumor@lemmy.ml 137 comments fedilink hide all child comments
[–] sirico@feddit.uk 32 points 2 years ago (2 children) It leads to typescript You get surprises from npm permalink fedilink source hideshow 4 child comments replies: [–] ByteJunk@lemmy.world 28 points 2 years ago (3 children) I spent way too long today figuring out why my app was doing something that it's NOT supposed to do on weekends. I read Luxon's docs (pretty cool lib tbh) again and again, and tried everything I could think of to get isWeekend to return a sane result. Turns out I was pulling a somewhat older version of Luxon, where isWeekend didn't exist. In any sane language, I expect I'd get a huge warning about a property that doesn't exist, but alas... Typescript helps me keep my sanity, but juuuuust barely. permalink fedilink source parent hideshow 6 child comments replies: [–] mynameisigglepiggle@lemmy.world 20 points 2 years ago* If isWeekend doesn't exist, then the weekend doesn't exist, so it's naturally false. That's why JavaScript gets pushed so hard - it's part of the capitalist agenda to keep us working 7 days a week permalink fedilink source parent [–] fxdave@lemmy.ml 7 points 2 years ago That's fair. Typescript has to cook with the existing js ecosystem. permalink fedilink source parent [–] kamen@lemmy.world 5 points 2 years ago (2 children) Weren't you getting runtime errors for the function not being found? permalink fedilink source parent hideshow 4 child comments replies: [–] humbletightband@lemmy.dbzer0.com 7 points 2 years ago (1 child) No, they were probably getting false every time permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 1 point 2 years ago* (1 child) Falsy* because it was undefined However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi. permalink fedilink source parent hideshow 2 child comments replies: [–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent [–] owsei@programming.dev 2 points 2 years ago (1 child) I don't know how luxon works, but isWeekend could be a property instead of a function permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 2 points 2 years ago It is. It also happens to be undefined, and checking that for truth is how I was bitten. permalink fedilink source parent [–] Thcdenton@lemmy.world 25 points 2 years ago You get suprises from npm permalink fedilink source parent
[–] ByteJunk@lemmy.world 28 points 2 years ago (3 children) I spent way too long today figuring out why my app was doing something that it's NOT supposed to do on weekends. I read Luxon's docs (pretty cool lib tbh) again and again, and tried everything I could think of to get isWeekend to return a sane result. Turns out I was pulling a somewhat older version of Luxon, where isWeekend didn't exist. In any sane language, I expect I'd get a huge warning about a property that doesn't exist, but alas... Typescript helps me keep my sanity, but juuuuust barely. permalink fedilink source parent hideshow 6 child comments replies: [–] mynameisigglepiggle@lemmy.world 20 points 2 years ago* If isWeekend doesn't exist, then the weekend doesn't exist, so it's naturally false. That's why JavaScript gets pushed so hard - it's part of the capitalist agenda to keep us working 7 days a week permalink fedilink source parent [–] fxdave@lemmy.ml 7 points 2 years ago That's fair. Typescript has to cook with the existing js ecosystem. permalink fedilink source parent [–] kamen@lemmy.world 5 points 2 years ago (2 children) Weren't you getting runtime errors for the function not being found? permalink fedilink source parent hideshow 4 child comments replies: [–] humbletightband@lemmy.dbzer0.com 7 points 2 years ago (1 child) No, they were probably getting false every time permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 1 point 2 years ago* (1 child) Falsy* because it was undefined However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi. permalink fedilink source parent hideshow 2 child comments replies: [–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent [–] owsei@programming.dev 2 points 2 years ago (1 child) I don't know how luxon works, but isWeekend could be a property instead of a function permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 2 points 2 years ago It is. It also happens to be undefined, and checking that for truth is how I was bitten. permalink fedilink source parent
[–] mynameisigglepiggle@lemmy.world 20 points 2 years ago* If isWeekend doesn't exist, then the weekend doesn't exist, so it's naturally false. That's why JavaScript gets pushed so hard - it's part of the capitalist agenda to keep us working 7 days a week permalink fedilink source parent
[–] fxdave@lemmy.ml 7 points 2 years ago That's fair. Typescript has to cook with the existing js ecosystem. permalink fedilink source parent
[–] kamen@lemmy.world 5 points 2 years ago (2 children) Weren't you getting runtime errors for the function not being found? permalink fedilink source parent hideshow 4 child comments replies: [–] humbletightband@lemmy.dbzer0.com 7 points 2 years ago (1 child) No, they were probably getting false every time permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 1 point 2 years ago* (1 child) Falsy* because it was undefined However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi. permalink fedilink source parent hideshow 2 child comments replies: [–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent [–] owsei@programming.dev 2 points 2 years ago (1 child) I don't know how luxon works, but isWeekend could be a property instead of a function permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 2 points 2 years ago It is. It also happens to be undefined, and checking that for truth is how I was bitten. permalink fedilink source parent
[–] humbletightband@lemmy.dbzer0.com 7 points 2 years ago (1 child) No, they were probably getting false every time permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 1 point 2 years ago* (1 child) Falsy* because it was undefined However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi. permalink fedilink source parent hideshow 2 child comments replies: [–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent
[–] shasta@lemm.ee 1 point 2 years ago* (1 child) Falsy* because it was undefined However, their IDE should have highlighted it as an unknown property. Guess this guy is coding in notepad or vi. permalink fedilink source parent hideshow 2 child comments replies: [–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent
[–] humbletightband@lemmy.dbzer0.com 2 points 2 years ago (1 child) Yep, thanks for correcting me. In fact, if they write something like if (day.isWeekend) {...} The block will never be executed with the old version of library permalink fedilink source parent hideshow 2 child comments replies: [–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent
[–] shasta@lemm.ee 2 points 2 years ago (1 child) Yeah that's exactly what I think happened to him. He needs a better IDE and/or needs to stop copy/pasting code from stackoverflow or documentation that doesn't match his library version. permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent
[–] ByteJunk@lemmy.world 0 points 2 years ago My dude, you need to understand that all that anger and resentment, it is not you. It's the years of JavaScript poisoning your mind. In any case, that goes to my point. I would have to be saved by my IDE, when any sane language will blow up in your face as soon as you try to run it. permalink fedilink source parent
[–] owsei@programming.dev 2 points 2 years ago (1 child) I don't know how luxon works, but isWeekend could be a property instead of a function permalink fedilink source parent hideshow 2 child comments replies: [–] ByteJunk@lemmy.world 2 points 2 years ago It is. It also happens to be undefined, and checking that for truth is how I was bitten. permalink fedilink source parent
[–] ByteJunk@lemmy.world 2 points 2 years ago It is. It also happens to be undefined, and checking that for truth is how I was bitten. permalink fedilink source parent
[–] Thcdenton@lemmy.world 25 points 2 years ago You get suprises from npm permalink fedilink source parent