• MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    75
    ·
    1 year ago

    When JavaScript was first released, it was a god-send. The alternative was vbscript and if you think JavaScript is bad…

    • lucidwielder@kbin.social
      link
      fedilink
      arrow-up
      21
      ·
      1 year ago

      Very true. I remember vbscript. I still have to write some occasionally. What’s funny is that powershell gets all the attention & security applied to it - but vbscript likely keeps its flaws in the name of backwards compatibility. I’m betting vbscript is a huge attack vector just waiting for some major exploitation that leads to its removal or being severely gimped.

        • allywilson@sopuli.xyz
          link
          fedilink
          arrow-up
          11
          ·
          1 year ago

          Correct. You know how JavaScript is not Java? Same thing. If memory serves me correctly there was a bit of a race to be the next Windows script language between NT4 and 2000 (to replace batch), and it was between VBScript and Kixtart (the former won out).

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

          Correct.

          To get a feel for what VBScript was like, think of Visual Basic. Now throw out all the good bits and mix in a bunch of JavaScript style quirks.

          Then try to parse binary data packets with it, beacuse XML isn’t widely supported and JSON has not been invented/discovered yet.

          It was bad.

    • ExaltedWarrior@lemmy.fmhy.ml
      link
      fedilink
      arrow-up
      10
      ·
      1 year ago

      Yeah, everyone hates JS but that doesn’t mean the existence of JS is a curse. For a long time it has been the best at what it’s commonly used for. Otherwise no one would complain about it because no one would use it.

        • andrew@lemmy.stuart.fun
          link
          fedilink
          arrow-up
          5
          ·
          edit-2
          1 year ago

          option base 42

          Sadly, per the syntax docs on O’Reilly it doesn’t look like it can be anything but 0 or 1. That’s not to say it’s a good feature, but at least make it fun if it’s gonna be bad.

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

        That’s such a perfect summary of VBScript. Starting array indexes at 1 was it’s vibe.

        VBScript would show up for it’s first day as a construction worker in a white shirt and a tie. I loved VBScripts willingness to do messy work, but boy was it unprepared in many contexts.

  • I use NixOS btw @lemmy.world
    link
    fedilink
    arrow-up
    35
    arrow-down
    8
    ·
    1 year ago

    I hate all these “hurr durr javascript bad” posts. It’s really not so bad, and worse languages exist. It’s really just a bad, overused joke.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      13
      arrow-down
      3
      ·
      edit-2
      1 year ago

      It’s really not so bad, and worse languages exist.

      Esoteric languages do not count. Super obsolete ones don’t either. At that point you’re left with maybe PHP.

      It’s really just a bad, overused joke.

      Now that might be true. I guess the main counterpoint is that it’s not like you never encounter it, so it’s natural it gets joked about a lot.

    • alokir@lemmy.world
      link
      fedilink
      arrow-up
      8
      arrow-down
      3
      ·
      1 year ago

      I’d bet that most people who think this way either haven’t used it in the last 10 years or they only know it from the memes.

      • whatsarefoogee@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        Nope. Use it very often, though mostly usually with typescript.

        Raw Javascript becomes a massive hindrance in any project past half a dozen files and 1000 lines.

        Typescript makes it a lot more usable.

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

          I agree, I also prefer Typescript, but I don’t think I’ve ever seen a meme about JS not having strongly typed variables.

          They either don’t center around any specific problem or things that are also mostly true about TS.

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

            The problem is refactoring. Want to rename a method? If the name isn’t unique enough to search for, you can’t do it. There’s too much risk that you’ll miss things and create severe bugs. Of course, that can be solved with really thorough unit tests, to some extent. But then you’re just spending a lot of extra time writing tests for things that typescript will enforce automatically.

            You also get much better autocomplete from the editor with typescript, which speeds up development a lot. You save a pretty huge amount of time if you don’t have to constantly look through documentation or even dig through a bunch of code to figure out what methods are available and how to use them.

      • jedibob5@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        It does some funky things with type coercion and comparison which I don’t particularly like, but I generally understand why it does things that way.

        A lot of the weird quirks of JS come from the desire to avoid completely blowing up and crashing as much as possible, which makes sense in a web dev context. Forcing weird operations to at least return something can prevent an unhandled error state in a single component from causing an entire page to crash, even if that component ends up malfunctioning.

    • Gork@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      The best languages allow you to program not just emojis as outputs, but with emojis themselves. 🫳⌨️🖥️

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

      Not my favorite language, but I don’t remotely hate it. The story of its creation is rather fascinating too.

  • fibojoly@sh.itjust.works
    link
    fedilink
    arrow-up
    25
    arrow-down
    1
    ·
    1 year ago

    Kids complaining about JavaScript while I’m at work, looking at fucking COBOL, or trying to maintain C# exe that were written by somebody who clearly did not understand OOP yet underlie the entire tool chain of a 3k+ employees company.

    Oh and go check out the “natural language” syntax of Macromedia Director scripting (Lingo), for your edification…

    Languages are tools. Some of them are really shitty tools, for sure, but if you think JS is it, you haven’t seen anything.

    • flashgnash@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      JS isn’t that bad provided you just use it for frontend UI, it’s quite good at that

    • TheSaneWriter@lemmy.thesanewriter.com
      link
      fedilink
      arrow-up
      10
      ·
      1 year ago

      I really like Typescript, I think it’s a more smooth programming experience than raw JS or even other high level languages like Python . However, I don’t mind JavaScript as much as many other programmers so I suppose I’m a bit biased.

    • alokir@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      One of my favorite languages, it’s everything that’s good about Javascript plus the one thing that’s missing: types.

  • Pfnic@feddit.ch
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    1 year ago

    I get why JavaScript can be terrible but at least there’s TypeScript. I’d argue Python suffers from the same problems but hasn’t got anything comparable to TS for keeping types in check and can’t autoformat well because whitespace is syntactically meaningful. In that way I think Python is worse to write maintainable code with.

  • candyman337@lemmy.world
    link
    fedilink
    arrow-up
    16
    arrow-down
    3
    ·
    edit-2
    1 year ago

    Js is what you make of it. It can be a godawful mess but it also can be really awesome. It’s a really easy language to understand that is a good thing. But it’s also a double edged sword because that means that novices can write absolute spaghetti code in it. That’s not the fault of the language though.

    • whatsarefoogee@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      1 year ago

      Being easy to understand is one of the primary goals of any programming languages.

      The problem with Javascript is that it isn’t easy to understand. Javascript is easy to write.

      That’s why it’s easy for novices to pick up and why it ends up being spaghetti code. It’s very unrestrictive and allows writing very poor code that works based on assumptions and breaks when the assumptions aren’t met.

      It made sense at the time because it was just a scripting language for some minor website things, and you didn’t want your site to crash if your script ran into a problem.

      Now it’s being used to write full fledged applications and it’s past design choices are still haunting it.

      • BeigeAgenda@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        1 year ago

        Compiled languages at least say “hey don’t do this” and fail or warn you with “this is a bad idea”.

        But hey I still use python, but also pylint to help me avoid mistakes, I just disable the style part for my own sanity.

    • chaorace@lemmy.sdf.org
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      1 year ago

      Js is what you make of it. It can be a godawful mess but it also can be really awesome.

      Agreed. It wasn’t always a great language, but by some miracle it eventually became pretty alright.

      But it’s also a double edged sword because that means that novices can write absolute spaghetti code in it. That’s not the fault of the language though.

      Disagree. The best languages are those which can be intuitively used without having to learn the pitfalls. Take Rust vs. C++, for example: both languages have pitfalls, but only Rust is intentionally designed to help you steer clear of them. JS is like C++ in this regard – decades of cruft have coalesced into tempting yet painful footguns, much to the chagrin of many a new learner.

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

      Js is what you make of it.

      This is one of the biggest issues with JS.

      Want to stuff your whole program into one file on a single line? Go for it! Want to use 100 JS files in a single directory? You the boss! Want to tinker with the internals of other modules? Ha! What internals?!?

      This is coming from someone that actually likes JS. It’s a very loosey-goosey language and it does next to nothing to prevent bad practices. You’re expected to pick and choose additional libraries to help with quality and organization. Some people choose no framework, some choose relaxed frameworks, or very opinionated ones. And if you want, you can easily mix strategies. I mainly code in Java, much more strict by comparison, and taking this approach would be a good way to ensure nothing works.

      I think the core of JS is good but it needs better official tooling (I still hate NPM) and less of do-what-feels-good approach.

    • Cethin@lemmy.zip
      link
      fedilink
      arrow-up
      4
      arrow-down
      2
      ·
      1 year ago

      Except nit having strict types makes it harder to read, not easier. You have to try to remember what type of data each object contains. Strict typing makes it easier to read. JS is slightly easy to write though, for better or worse, although usually harder to come back to for the same reason mentioned earlier.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Big disagree. The point of a language is to express the underlying logic in a human-friendly way.

      Edited to emphasise parsing does not mean understanding.

        • CanadaPlus@lemmy.sdf.org
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          You said it can be used and is easy to understand (which I interpreted as parse), that’s subtly different. Awful spaghetti code that works does not show the underlying logic easily to humans, it doesn’t really matter if you can easily understand a line. It is JavaScript’s fault if it lends itself to that unnecessarily.

          I get why people were confused by what I wrote, though. I’ll go back and make an edit. Sorry!

    • starman@programming.dev
      link
      fedilink
      arrow-up
      20
      arrow-down
      6
      ·
      1 year ago

      Terrible type system, terrible standard library, terrible compatibility and lack of many features, compared to C# for example.

      • Ricaz@lemmy.world
        link
        fedilink
        arrow-up
        11
        arrow-down
        7
        ·
        1 year ago

        All of those things are by design and comparing JS to a fully fledged OOP language is just the sign of a clueless developer.

        The JS standard is well defined and compatibility has nothing to do with the language itself

        • FlashPossum@social.fossware.space
          link
          fedilink
          arrow-up
          19
          arrow-down
          3
          ·
          1 year ago

          Terrible type system, terrible standard library, terrible compatibility and lack of many features

          All of those things are by design

          That makes it even worse.

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

            Lots of languages are typeless and the standard library is weak because web (NodeJS is good but npm is shit)

            • tool@r.rosettast0ned.com
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              1 year ago

              I hate Node and NPM so much that I have a physical reaction to just seeing the words now.

              I already disliked Node & NPM quite a bit, but the hatred and disgust got to the point it is now after having to write a CI/CD pipeline in Groovy/Jenkins for a Node site that that our devs were building. I had to automate the build/deployment of Satan’s favorite framework in Satan’s favorite language. I came pretty close to quitting.

              It’s out the door now, but I’m in the middle of reimplementing the pipeline in Github Actions so I don’t drink myself to death when they come knocking to do it again.

          • outdated_belated@lemmy.sdf.org
            link
            fedilink
            arrow-up
            3
            ·
            1 year ago

            I feel like a good portion of people hate many languages, tbh. This is at least partially because they’re often forced to use them based on company mandates, rather than their own volition.

          • proton_lynx@lemmy.world
            link
            fedilink
            arrow-up
            3
            arrow-down
            4
            ·
            1 year ago

            I think the whole ecosystem around the language is enough to understand it sucks. The tools, the build system, etc. Plus, I don’t like Microsoft.

            • lobut@lemmy.ca
              link
              fedilink
              arrow-up
              4
              ·
              1 year ago

              I mean old school Visual Studio made it restrictive in the past.

              I figured with VS Code, .NET core, NuGet and stuff made it better.

              I won’t fight back on MS hatred.

            • starman@programming.dev
              link
              fedilink
              arrow-up
              4
              arrow-down
              1
              ·
              1 year ago

              What’s wrong with the tools? Rider is the best IDE I’ve used, visual studio it’s that bad ether

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

        It’s missing a lot of things that people really care about (with good reason) like static typing. But I think a lot of dislike also comes from it being more of a functional programming language and not object oriented. I like it because it’s like scheme or lisp but with a C like syntax that I find easier to read. I also like that I can do dynamic stuff with websites. In some ways it’s the perfect scripting language for the web. Just as messy and unpredictable as html.

        • DarkenLM@kbin.social
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          There are “classes” (syntatic sugar over prototyping) that allow OOP in JS, so I don’t think why people would dislike it for the lack of OOP, unless they’re using ES5.

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

            Some would say that until you’ve played “guess whether my clone still points back to the original object” in JavaScript, you’ve never really lived.

            That said, I understand I’m supposed to start using TupeScript for that, so I’ll shut up about it.

            • DarkenLM@kbin.social
              link
              fedilink
              arrow-up
              2
              ·
              1 year ago

              Oh, yeah. When people discover shallow clone vs deep clone is when shit hits the fan. Though anyone that comes from a C background shouldn’t fall on those traps either way.

  • palordrolap@kbin.social
    link
    fedilink
    arrow-up
    7
    ·
    1 year ago

    In 1994, CGI back-ends were the closest thing to interactivity in the browser, and that’s far back enough that a good deal of it was written in C. Strong typing abounds!

    But JavaScript was an absolute joy by comparison. Heck, even Perl CGI was a joy compared to having to write executables for every fricking thing.

    Note that by JavaScript, I mean the mostly hand-crafted stuff in earlier sites, not the enormous frameworks that are in use these days.

    • fibojoly@sh.itjust.works
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      Hear, hear! In 1998, I did my work experience at a local ISP and was tasked with coding a backend that would create accounts for people wanting to buy an internet subscription from us.
      IIS was still in beta so my boss decided I would use Linux, this new fangled language called PHP and just write a CGI in C that would do the actual creation of accounts on our server (IIRC).
      I spent a few weeks on a console terminal, using vi, doing C; which was as abominable as one might expect. PHP was fucking magic, in comparison. And on the front-end, I used a bit of JavaScript to add some interaction and reactivity and that was just fun!

      Heck, seventeen years later and I still think it’s a fun language to use.

      Anyway I don’t know where in was going with this… you kids don’t know how good you have it, is what I’m saying.

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

      Flex and grid have made CSS so easy I can’t imagine how anyone could hate it anymore. Back when everyone used float for layout, it was painful, but no sane person does that anymore.

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

      Flash was what made me interested in the internet to begin with. Flash games back in the day were great because the barrier for entry was so low people could make all kinds of crazy stuff with it.

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

    a lot of its quirks really do start to make sense when the whole language was essentially designed in about a weekend. a lot of my own weekend code still haunts me to this day

    • argv_minus_one@beehaw.org
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      There are plenty of things wrong with the tool itself.

      For example, there is no way to define an equality and hash function for a class, so there is no sensible way to use arbitrary data structures as Map keys.

    • barryamelton@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Wasm is the stack created by the Wasm architecture spec and its instructions, an interpreter for that (think VM), and whatever language you are compiling into Web Assembly (js, go, rust, python, c#…). More and more languages are gaining support to compile them to Wasm (the same way they can be compiled to amd64, arm architecture, etc).

      It’s like comparing apples with a grocery store. Also, yes Wasm is better!