53
king
4y

I hate all of these rants about JavaScript being a terrible language.

In reality, it's one of the easiest languages to work with. This makes it easier for new programmers to write messy code, but is it the language's fault?

People get mad about the things that happen when you multiply "undefined" and a string...what do you expect?

You also have the freedom to choose from a variety of tools the community has created to solve existing problems. People just don't realize that they don't *have* to learn everything, you just learn as you need them.

Don't blame JavaScript for you bad programming, terrible type conversion needs, and great tooling.

Comments
  • 7
    Javascript === bae❤️
  • 11
    I do not hate JavaScript. But there are undeniably huge problems with it, the biggest one being that it is still the only truly cross-browser application platform.
    There have been countless attempts to replace, compete with or 'fix' JS - the best one currently probably being TypeScript. But it does not change the fact that while it is absolutely great that beginners and intermediates can quickly get going doing some DOM manipulation etc. for smaller projects, there is no true enterprise/large project alternative.
    That is why I think many developers hate it. Because even now, there is no choice but to use some version of JS if you are developing a browser application.
  • 1
    Yes! Great points all around
  • 3
    @pleuph Yeah, it might not be your style. Luckily, there is WebAssembly.
  • 0
    I read this kind of rants a few years ago, but it was about php back then
  • 4
    @king WebAssembly shows promise, absolutely. But so did many other great technologies that nevertheless died out because of the enormous market penetration of JS.
    I do hope it will survive, but I remain sceptical.
  • 2
    @pleuph it's been accepted as part of the standard, and both chrome and Firefox have it iirc. It'll exist no matter what
  • 1
    @iam13islucky Sure, and that's great. But there's still a long road ahead to get the industry using it.
  • 1
    @kpenc I find it hard to believe you if you don't provide any evidence or issues you've had with it.
  • 1
    @MilyMilo Transpilers and bundlers aren't needed for the language to work, they just convert and bundle up files so they work on older browsers.

    Don't tell me you don't need SOME sort of setup when using something else.
  • 0
    @runfrodorun I get what you mean. JavaScript can get really messy if you don't have any rules or structure, but any good programmer should follow some sort of style guide.

    API's can't be blamed on the language itself either, it's not the language's fault that DOM API is slow and clunky.

    The point I'm trying to make is that people always blame the language for things that isn't related to it. It's a simple C-like interpreted language that is easy to pick up, but also easy to mess up.
  • 1
    @MilyMilo Is that the language's fault? A simple React component doesn't require Redux OR Webpack, you can write it with a simple script tag.

    If you don't like it, you choose something else, it's that simple.
  • 2
    @MilyMilo you didn't have to do all that for just a simple react component. Could just downloaded the library and used es5 if Babel is too hard.
  • 2
    @MilyMilo In fact, here is a simple react component: https://jsfiddle.net/93oo10h8
  • 3
    The alternatives was flash and silverlight.
    Js is amazing compared to that crap.
  • 1
    @superuser Have you actually developed a Silverlight application? Because I have. A very desktop-app-like setup app with 40+ configuration tools for a huge Business Intelligence solution. And it was not comparable to anything you could build with JS/HTML/CSS. Not in terms of ease of development and design, not by a long shot.
    Silverlight really could have saved the enterprise browser application if Microsoft had just opened up the source a few years earlier.
    Oh well...
  • 3
    @pleuph i am a .net developer, but lets be real, js is a very powerful language, for a very specific purpose.
    I use js just to manipulate the view and connect to the api and never had a single issue due to the language.
    Silverlight was more powerful but it was harder to use and most of tje times you have to do more work for the same result.
    Anyway, my opinion is that js is by far the most complete technology for the web until now.
  • 0
    Is it the languages fault that it promotes messy code? Why, yes it is! A well designed language conditions good programmer patterns by its very design.

    A great recent example is Go which discourages you from doing weird and overcomplex things by simply not providing those features in the language. It also commonly has One way to do standard things. Compared to js where there are no ends to the way you can bastardize basic fucking things like calling a function.
  • 1
    @superuser Okay. For me, being familiar with xaml from wpf development and having little experience with js/html, Silverlight was far, far easier to utilize for my project. And it also brought a far more familiar experience for the users.
    I am of course not saying that that would be the case for any project, far from it. But for me and my team, js based solutions (which we prototyped of course) would have been far more costly in development time and far less usable according to the design specs.
    These are my personal experiences, which is not to say that anyone elses are in any way less valid.
  • 1
    @tobsve I sort of agree, bit there are tools like TypeScript and ESLint to enforce some rules. The problem is that the browser can't make significant changes to the language, as it would most likely break the internet.
  • 0
    @runfrodorun Yeah, like any language, JavaScript has some downsides.
  • 0
    I hate most of those as well. It's not because they're against JS because as you point out some other factors.

    The amount of obnoxiousness and pettiness is annoying but also ulterior motives. Most people bashing JS do so from the position of trying to steer people or elsewhere, into their domain which they are familiar with where they are the master.

    I'm not blind to the annoyances people bring up and when purely informative it's nice but most of the time it's noise.

    I do have some serious annoyances with JS though. Think {} can be used as a safe map<string, any>? Think knocking out its prototype will solve the issue? Think again.

    That's legacy but it's worse. New features such as async/await are broken. The people meant to be making JS better are making it worse. They're only making it more aesthetically pleasing but they can't even implement a function! If you test the async/await implementation against that of other languages you'll see.
Add Comment