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

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

    Aight I’m out

  • lunarul@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    edit-2
    11 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.

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

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

      • festus@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 minute 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
          ·
          1 hour 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?

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          4
          ·
          7 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
            ·
            45 minutes 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
              1
              ·
              23 minutes 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.

  • Xylight@lemdro.id
    link
    fedilink
    English
    arrow-up
    2
    ·
    9 hours ago

    I don’t like calling myself a JS/TS dev but my biggest project that I currently work on is written in it, so I had to try it.

    16/28. I mean it’s incredible how I can throw a diabolical amount of variations of formatting at it and somehow get valid dates.

  • schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    2
    ·
    8 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.