Jamesj999 Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Sheldan@programming.dev to Programming@programming.dev · 19 hours ago

new Date("wtf")

jsdate.wtf

external-link
message-square
40
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
164
external-link

new Date("wtf")

jsdate.wtf

Sheldan@programming.dev to Programming@programming.dev · 19 hours ago
message-square
40
fedilink
  • cross-posted to:
  • programmerhumor@lemmy.ml
How well do you know JavaScript's Date class?
alert-triangle
You must log in or register to comment.
  • catalyst@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 hour ago

    It only took one question for me to start wanting to flip tables.

  • thenextguy@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    edit-2
    3 hours ago

    Alright, enough making fun of languages that suck…let’s talk about JavaScript.

    https://www.destroyallsoftware.com/talks/wat

  • brb@sh.itjust.works
    link
    fedilink
    arrow-up
    7
    ·
    6 hours ago

    Except for some reason “2” is interpreted as a month, and the year is set to 2001.

    Aight I’m out

  • FizzyOrange@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    8 hours ago

    Ha this is even worse than I could have imagined!

  • Mr. Satan@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    7 hours ago

    I scored 10/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

  • tatterdemalion@programming.dev
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    10 hours ago

    Can we start a new web with a better language/platform already?

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      8 hours ago

      Google tried to do that with Dart, and failed. In fairness Dart 1 was much worse than Dart 2… So maybe that was a good thing because there’s no way they’d have been able to improve Dart as much as they have if it was part of the web.

      For dates there finally is something better anyway: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal

    • esa@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      8 hours ago

      There’s wasm if you need to target browsers.

      • festus@lemmy.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        1 hour ago

        Yes and no. Wasm has no “standard library” so if you wanted to use Dates, your wasm would need to have its own implemation bundled for when the user visits the page. Ditto for everything else including string support! As you can imagine having to ship all this basic functionality can bloat the wasm and slow page loads.

        You also can’t fully escape JS, as the only way wasm can interact with the page & browser are through the JS functions you write and make available to your wasm. I suppose you could take advantage of this to not have to ship your own standard library & use the JS Date implementation, but at that point why not just use JS?

        Wasm has strengths but it’s not suitable for replacing JS for everyday websites.

    • FooBarrington@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      3
      ·
      9 hours ago

      Why? Why not improve JS (e.g. with Temporal), especially given how excellent Typescript is?

      • Sheldan@programming.devOP
        link
        fedilink
        arrow-up
        3
        ·
        3 hours ago

        I wouldn’t call typescript excellent, if I did it would be on a very low standard.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          2 hours ago

          It unquestionably is excellent. Can you name another language in common use with a type system that’s close to the expressiveness of Typescript?

      • tatterdemalion@programming.dev
        link
        fedilink
        arrow-up
        7
        arrow-down
        1
        ·
        9 hours ago

        JS is a lost cause.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          4
          ·
          9 hours ago

          How? It’s easy not to run into the common issues by using TS. What’s so bad about it that we should throw away the existing ecosystem?

          Please give arguments instead of platitudes.

          • bleistift2@sopuli.xyz
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 hours ago

            You don’t need to use TS to avoid common issues. If you add an empty object to an empty array and expect a meaningful result, the problem sits in front of the keyboard.

            • FooBarrington@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              2 hours ago

              Sure, discipline can prevent some errors. But it’s always possible to run into wrong type assumptions, and I’d say type coercion and null/undefined access make up a fairly large percentage of non-logic errors. You can entirely prevent those using Typescript, which is why it’s so useful.

              Static type analysis is always a good idea if you’re writing more than a couple lines. IMO Python is the worst offender with its kwargs etc. - discoverability and testability is just so bad if you’re following common Python idioms.

  • lunarul@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    12 hours ago

    If you’re not very familiar with JS, watch the Wat talk before taking the quiz to know what to expect from this wonderful language.

    • Lemminary@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      10 hours ago

      And then promptly get yourself familiar with how the language actually works. https://github.com/getify/You-Dont-Know-JS

      People who complain about JS often assume it has features of other languages and fail to realize it has its own architecture and winding history.

  • atzanteol@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    8
    ·
    11 hours ago

    Nobody understands JavaScript. It’s the quantum mechanics of the software world.

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    18
    ·
    14 hours ago

    I scored 13/28 on https://jsdate.wtf/ and all I got was this lousy text to share on social media.

    Oof. I’ve been a JS dev since 1998.

  • DrWorm@piefed.social
    link
    fedilink
    English
    arrow-up
    23
    ·
    15 hours ago

    The quirks in this quiz aren’t even universal, and vary based on which browser you’re using. See the table at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse#non-standard_date_strings

    Also I got 13/28 😑

  • ragingHungryPanda@lemmy.zip
    link
    fedilink
    arrow-up
    21
    ·
    15 hours ago

    I got 10/28, but I was crying after the 7th question

  • Sorse@discuss.tchncs.de
    link
    fedilink
    arrow-up
    1
    ·
    8 hours ago

    12/28

    Surprised that I got this score when I only know python

  • fubarx@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    10 hours ago

    9/28. WTF’ing through 90% of the questions.

  • MTK@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    8 hours ago

    This is just a good reminder of human nature to make bad choices (using JS) and stick with them forever.

  • schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    2
    ·
    10 hours ago

    7/28. Of course no one would ever do most of those things, they are interesting to think about but with little practical use.

Programming@programming.dev

programming@programming.dev

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: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

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

  • 424 users / day
  • 1.19K users / week
  • 2.67K users / month
  • 7.45K users / 6 months
  • 1 local subscriber
  • 21.5K subscribers
  • 2.35K Posts
  • 36.2K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.9
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org