• humanspiral@lemmy.ca
        link
        fedilink
        arrow-up
        4
        ·
        11 hours ago

        They ended up with Javascript trademark (afaik, because the name was too close to Java) too. Sued node.js over something related.

        • BatmanAoD@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          7 hours ago

          Apparently the JS name was selected and announced in partnership with Sun from the very beginning, and Sun had the copyright over both Java and JapaScript up until the acquisition by Oracle. I had no idea, but that makes perfect sense.

          • humanspiral@lemmy.ca
            link
            fedilink
            arrow-up
            1
            ·
            3 hours ago

            Sun, afaiu, was part of a large committee on js without any particular leadership. They got the committee to agree to giving it trademark by complaining/threatening that the name was too close to java. Sun got trademark 4 years after Netscape started support for js. ECMAscript was mostly the same committee without SUN ownership/trademark.

  • brb@sh.itjust.works
    link
    fedilink
    arrow-up
    23
    ·
    1 day ago

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

    Aight I’m out

    • humanspiral@lemmy.ca
      link
      fedilink
      arrow-up
      5
      ·
      14 hours ago

      “12.1” is interpreted as the date December 1st, and as before for dates with no year the default is 2001 because of course.

      it gets better and more coherent the deeper you go :P

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

      • sudo_halt@lemmygrad.ml
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        13 hours ago

        Dart is fucking amazing and it compiles to native code, transpiles to JS (with some restrictions on concurrency because of web workers) and also supports WASM.

        Really if you want to write async and stream based code Dart is very good

      • festus@lemmy.ca
        link
        fedilink
        English
        arrow-up
        6
        ·
        edit-2
        23 hours 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
          3
          arrow-down
          4
          ·
          1 day 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
            ·
            24 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
              3
              ·
              23 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.

        • FooBarrington@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          2
          ·
          24 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?

  • bleistift2@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    34
    ·
    2 days ago

    I am a frontend dev. JavaScript (well, TypeScript) is my bread and butter. Even knowing its quirks I never would have thought how inconsistent Date actually is. I encourage everyone to try this quiz.

    This is what JavaScript haters should bring forth, not 0.1 + 0.2 !== 0.3!

    • dalekcaan@feddit.nl
      link
      fedilink
      arrow-up
      2
      ·
      15 hours ago

      Or the ones where people point out how inconsistent JS is with adding strings to numbers.

      Yeah, maybe don’t do arithmetic on numbers as strings?

    • Hotzilla@sopuli.xyz
      link
      fedilink
      arrow-up
      22
      ·
      1 day ago

      Floating point rounding issues are basic comp science issues. Hopefully nobody thinks that those are JavaScript quirks.

    • Tanoh@lemmy.world
      link
      fedilink
      arrow-up
      12
      ·
      2 days ago

      There is a reason almost everyone use some Date lib, like Luxon and not the built in. And well, having a horrible built in lib that they can’t change due to legacy code breaking is nothing really new or unique to JS.

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

        The built-in lib is fine for basic stuff unless you do some crazy shit like expecting "2" to parse as a valid date.

        • Tanoh@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          13 hours ago

          For very basic things maybe, but it has a lot of other weird problems and restrictions. Mutability, no real timezone support, very limited arithmetic, to name a few. As soon as you move beyond the very basic, you want someting more robust.

  • Macallan@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    2 days ago

    I got a 4/28 and got told I would have scored higher if I guessed at random. Ouch. (I am not a dev)

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 day ago

      I mean, for what it’s worth, I’m a seasoned dev and just did a run where I tried to answer everything as it makes sense to me (which is “throws an error” or “invalid date” for all of them) and I also got a score of 4/28.

      …and two of those points were given to me, because the quiz interpreted my answer differently than I meant it.

      In other words, this quiz exists to highlight that JavaScript’s Date functions make no sense.