programming.dev
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
JPDev to Programmer Humor · 1 year ago

===

message-square
76
link
fedilink
678

===

JPDev to Programmer Humor · 1 year ago
message-square
76
link
fedilink
  • Buttons
    link
    fedilink
    English
    arrow-up
    76
    arrow-down
    1
    ·
    edit-2
    1 year ago

    https://programming.dev/post/7789832

    • BaardFigur@lemmy.world
      link
      fedilink
      arrow-up
      19
      ·
      1 year ago

      deleted by creator

      • schnurrito@discuss.tchncs.de
        link
        fedilink
        arrow-up
        16
        ·
        1 year ago

        by not ever using == and !=, but only === and !==

      • blackn1ght@feddit.uk
        link
        fedilink
        arrow-up
        10
        ·
        1 year ago

        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)
        
        • BaardFigur@lemmy.world
          link
          fedilink
          arrow-up
          8
          ·
          edit-2
          1 year ago

          deleted by creator

        • JaddedFauceet@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 year 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()];
          
      • FooBarrington@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        1 year ago

        Typescript :)

        • ByteJunk@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          Yep. It’s the only reason I’m still somewhat sane.

          • fidodo@lemmy.world
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            I got by without it for years, but not that I have it I have no idea how I did it back then.

      • JaddedFauceet@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        1 year ago

        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

        • fidodo@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          1 year ago

          And typescript is basically just a linter on steroids

      • darcy@sh.itjust.works
        link
        fedilink
        arrow-up
        7
        ·
        1 year ago

        almost forced to for web front end. why you would use it anywhere else, however, i will never know

        • Turun@feddit.de
          link
          fedilink
          arrow-up
          4
          ·
          1 year 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.

      • FrostKing@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        1 year ago

        Ikr? English is hard /s

Programmer Humor

programmer_humor

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.05K users / day
  • 4.41K users / week
  • 8.62K users / month
  • 18K users / 6 months
  • 2.39K local subscribers
  • 23.2K subscribers
  • 1.38K Posts
  • 51.7K Comments
  • Modlog
  • mods:
  • adr1an
  • Feyter
  • BurningTurtle
  • Pierre-Yves Lapersonne
  • BE: 0.19.11
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org