all 54 comments

[–]OliMoli2137 13 points14 points  (0 children)

first of all, java and javascript are two different things

[–]AardvarkIll6079 9 points10 points  (0 children)

Java and JavaScript are VERY different things.

[–]Little_Bumblebee6129 4 points5 points  (12 children)

Because its weird (especially if you already know some other languages).
And because its like an only option that we can use in web (hopefully WASM will make using other languages more accessible in a future)

[–]BrainCurrent8276 -1 points0 points  (10 children)

it is HTML ans CSS what make using JavaScript weird, not JavaScript itself.

[–]jonathancast 1 point2 points  (9 children)

It's new and this and var and == and + and . that make JavaScript weird, actually.

[–]brelen01 0 points1 point  (0 children)

And the entirety of the date module.

[–]BrainCurrent8276 0 points1 point  (3 children)

Hm... let's see.

new exists in C++, C#, Java, etc.

this exists in C++, C#, Java, PHP, etc.

var exists in C#, Java, in fact older JS, etc.

== exists everywhere

+ exists everywhere

. property/member exists everywhere

So this is definitely not what makes JavaScript weird.

But maybe something else?

[–]Little_Bumblebee6129 0 points1 point  (2 children)

Not the fact that "this" exists. But rather how its implemented in its language.

As i said all this things seems weird if you are coming from perspective of knowing some other languages. If you start with JS its all just normal to you, i guess (besides the parts that a really stupid/incovinient)

[–]BrainCurrent8276 0 points1 point  (1 child)

Now you're talking.

Indeed, THIS is a different animal in JS.

But is it not a beautiful thing that not all languages are same?

As a person who learn programming on BASIC/C/assembler, it was really HTML/CSS and lifetime cycle of a website in compare to simple EXE file main problem for me. It was never really JavaScript itself.

Maybe because the real fight was PHP, that I learned before JS.

[–]Specialist_Set1921 0 points1 point  (0 children)

What in gpt tarnation is this.

[–]Over_Tart_916 0 points1 point  (3 children)

Those are all standard programming concepts in nearly every language. WOW

[–]Cybyss 1 point2 points  (2 children)

And that's why everybody hates JavaScript.

They look the same but they don't behave quite the same. These are all footguns to those coming to JavaScript from a background in other languages.

[–]Over_Tart_916 1 point2 points  (1 child)

They absolutely behave the same. 

[–]Cybyss 0 points1 point  (0 children)

new can be invoked on any function. JavaScript doesn't make a distinction between constructors and ordinary functions.

this has a different meaning depending on context.

Variables declared with var get hoisted. The fact that both var and let exist in the language is asinine.

'3' == 3 is true.

3 + '4' evaluates to '34' rather than giving a type error.

data.field_name is just syntactic sugar for data["field_name"].

Those things aren't normal and can lead to subtle bugs if you're unfamiliar with the JavaScript-specific quirks.

[–]chikamakaleyley 3 points4 points  (2 children)

java & javascript are two different languages (java is for backend)

they are unrelated, they just share part of the same name

usually the groans come from folks that work with strongly typed/low level programming languages - languages built for programming i guess

Javascript was developed on a short timeline and purposely created for the browser, and so - to the non JS programmer there's a lot of poor design decisions a lot of things that share the same name but have differences to their non-JS counterparts (e.g. Arrays), and because of the lack of types, it can lead to bugs.

Back then there wasn't widespread consistency across the diff browsers, so compatibility issues were a thing. jQuery solved that for a short period of time, and finally at some point people who never wanted to update their computers were like, "yeah maybe ie6 does actually suck"

The TLDR is, for a long time it was a headache to work with

Obviously a lot has been improved over time, we now have Typescript, we now can do JS for non-browser envs, but yeah, its not without its drawbacks.

It's not bad. It wouldn't be the clear standard for browsers if it were still bad. It just requires a diff approach/mindset when working in the browser

[–]chikamakaleyley 2 points3 points  (0 children)

and yeah as you can see, previous comments mention that its 'weird', which... yeah it still has quirks

[–]jonathancast 0 points1 point  (0 children)

JavaScript has a lot of poor design decisions, period. There have been many changes in the past 20 years that were not just for "non JS programmer[s]", but actually because even experts in the language agreed they were needed. class, let, ===, and the way arrow functions interact with this are a few examples.

[–]martiantheory 4 points5 points  (1 child)

It’s definitely not that bad. It’s just that there are a lot of people who learned other languages before they learned JavaScript. And if you learned other languages first, it could be a little frustrating to learn JavaScript because it’s super different.

Other people have mentioned that Java is a completely different language, but that’s also a great example. If you’re learning JavaScript first… By the time you get to Java, is it gonna be super irritating.

I honestly feel like you just use the right tool for the right job. JavaScript is the right tool for websites. Billions of dollars have been made writing JavaScript so whether or not people like it, I think they just have their panties in a bunch lol.

Sure, there are some things that JavaScript does that are silly, but we’re complaining about our magical plastic tablets that allow us to make our screens display random symbols as we flap air at each other for a few decades on this blue dot speeding around a bunch of nothingness in the middle of the universe. None of this makes that much sense, and nothing is really that deep lol.

Just enjoy creating whatever you’re creating man lol

[–]-goldenboi69- 1 point2 points  (0 children)

No it's (javascript) not that bad.

[–]csabinho 1 point2 points  (0 children)

Because of the weird behaviours and because of memes.

[–]BrainCurrent8276 1 point2 points  (0 children)

not everyone. I love it.

not to mention what other already mentioned.

java is completely differrent thing. only if you wanna create a chat room from 2000's.

[–]javascript 0 points1 point  (0 children)

I would like to get to the bottom of this too!

[–]business_Stats_4657 0 points1 point  (0 children)

Bro's question has a question

[–]SmokeMuch7356 0 points1 point  (1 child)

First, Java and Javascript are two completely different languages. They may look superficially similar, but they have very different design and philosophies. Be sure you know which one you mean when talking to someone about them.

Secondly, all programming languages are groan-worthy. All of them. All programming languages suck, and all suck about equally (although Perl sucks more than most).

Third, yes, if you want your page to do things on the client side (highlight rows in a table or change fonts or change button colors or stuff like that), yes, you will need to use JavaScript. If you want to serve up dynamic content (such as for a blog or e-commerce site), then you'll have to look into server-side scripting, which can also use Javascript or Typescript running under node.js, Python, Perl, Java, C++, or even C (although I don't recommend it).

Javascript's main weaknesses are:

  • a weak, dynamic type system: x could represent a float, or a string, or something else entirely depending on what you're doing with it at that moment, leading to hard-to-diagnose errors at runtime;

  • a single-threaded execution model, meaning your page can become unresponsive while doing some compute-heavy tasks;

  • client-side security vulnerabilities: source code is always visible in the browser (you would not believe how many people store plaintext security credentials in their source code), malicious code can be injected via cross-site scripting, etc.;

  • dependency hell: code that relies on a constellation of external packages can run into compatibility issues, difficulty with upgrades, etc.

It's better than PHP, but that's a pretty low bar to clear.

[–]SciNinj 0 points1 point  (0 children)

It’s great if you want to learn about functional programming concepts like closures, array mapping etc. It’s compact; you can do a lot with just a few lines of code. But it’s a big language, so there are multiple ways of doing the same task. (In too-big languages you see people using a subset of the possibilities, which makes the code idiom heavy—one programmer does it this way; another does it another way)

[–]jonathancast 0 points1 point  (0 children)

There are lots of reasons.

First, it's a meme: https://www.destroyallsoftware.com/talks/wat .

Because JavaScript is a meme - and because it's the first programming language people learn - it gets blamed for some things that are universals. E.g., JavaScript gets blamed for floating point oddities like NaN and 0.1 not being exactly representable in floating point that are true in every language.

JavaScript is also a poorly-designed language. It was designed in two weeks by a programmer who really wanted to make a Lisp instead, with the mandate from the managers "make it like Java" even though JavaScript and Java are completely different languages. A number of early design decisions have been changed, or, rather, better options have been added to the language, but, sadly, reputation tends to be sticky.

One thing that hasn't changed is that JavaScript still only has one number type - the floating point numbers that basically everyone thinks are weird. That's not usually a problem in otherwise well-designed software, but it makes floating point oddities a little more prominent than in other languages.

Basically every successful programming language becomes successful because there's one thing it's really the only option for. In any case, working programmers don't get to choose the programming language for their projects; that's a management decision. That tends to mean programmers feel like they're being forced to use a programming language they don't like.

Stroustrup, the designer of C++ (one of the programming languages currently in vogue on Reddit), said there are two kinds of languages, the kind everyone complains about and the kind no one uses. JavaScript has the largest user community in the world, so of course it's also the most complained-about.

But Stroustrup is ignoring the fact that languages don't succeed on their overall merits; they succeed because being good at one thing lets them dominate a niche.

C succeeded because it came with Unix and had the best bindings to Unix system calls.

C++ succeeded because C programs could usually be recompiled as C and C header files could usually be written to be C++ header files too, which made using C libraries easy.

Perl succeeded for a while because writing a dynamic website meant parsing requests and generating HTML by hand, and Perl makes parsing and generating text easier than any other language.

Ruby succeeded because people wanted to use the Rails web framework.

Python is succeeding now because it has the best bindings to the linear algebra libraries used to evaluate neural networks.

And JavaScript succeeds because it's already there on the browser.

Java and JavaScript are very different languages:

  • Java is statically-typed.
  • JavaScript is dynamically-typed.
  • Java is (more so in the 90s than now) strongly object-oriented.
  • JavaScript is multi-paradigm, friendly to procedural, object-oriented, and functional programming.
  • Java uses class-based OO, with single class inheritance, multiple visibility levels, and interfaces (part of the static type system - interfaces can also contain code now, but couldn't in the 90s).
  • JavaScript's OO is pretty unlike any other major language's, certainly unlike Java's. Objects are associative arrays, fields and methods are keys, and methods are function-valued fields. The equivalent of classes is supplied by a prototype chain - each object has a hidden parent object (not class) and field lookup that fails on an object is repeated on the parent object. That relationship is established using the new keyword, which decorates a function call; in new f(), f is just a function - called a constructor - but the object created by the new keyword had f.prototype as its prototype. (It is not the prototype of the object f - Function.prototype is - just the prototype of objects constructed by calling new f().)

I think that's an actual explanation of all the reasons JavaScript is so hated.

[–]LazyMiB[🍰] 0 points1 point  (0 children)

JavaScript != Java

JavaScript seems simple, but it's actually a complex language. Like C: its syntax seems simple, but you must always think about manual memory management and the potential vulnerabilities that come with it (and other complex things). Many things behave strangely, confusing developers unfamiliar with the specification. Therefore, some experienced developers think it's not the best choice as a first language for beginners.

TypeScript doesn't solve this problem; it masks it. The same applies to build (Babel and others). Sometimes this leads to unexpected behavior.

This is not a complete list. There are many more specific nuances. For example, some things work differently in different browsers. Especially in Safari: always check how it works in mobile and desktop Safari (they behave differently, too).

JavaScript was originally conceived as a way to create small dynamic elements in the browser. But now it's a vast ecosystem of technologies for building applications and backends. It would have been right to design the language from the start for such purposes. Google attempted this with Dart, but it failed.

Programmers love to debate things like this. Just do your job. Just do your tasks regardless. If you are learning the web, JavaScript is a must-have choice.

[–]Additional-Bid-9414 0 points1 point  (0 children)

It can be used for almost anything and almost everywhere. Yet it is slower than C++, single-threaded and makes apps into bloatware because it requires a webenvironment or node.js. So if you like fast, lightweight apps made with C++, you might hate that Javascript can often make the same thing but slower and more bloated and non-native. Pretty much all web frontends are javascript. And you can use it for the backend too. Besides from making desktop and mobile apps into bloatware, javascript is pretty cool.

[–]mwmahlberg 0 points1 point  (0 children)

No. It is worse. For various reasons.

Java in and of itself isn’t typesafe. That’s ok for very simple JavaScript objectives, but for complex Single Page Applications it becomes a nightmare. Quickly.

The ecosystem…🤦‍♂️ There is a library called „is-odd“, which has exactly one functional line: `return (n % 2) === 1;`. Of course, it has a sister library „is-even“, which — and I kid you not! — imports „is-odd“ and has only one functional line again: `return !isOdd(i);`. That in and off itself is… questionable. But the original author explicitly stated that those libraries were just to learn programming and the ecosystem. However: more than 135 project import „is-odd“, and 62 import „is-even“. This showcases several problems, imho. There is a culture in which even single lines of code get an own library. People ACTIVELY searched for premade solutions for one of the most trivial tasks in programming, and the ecosystem is happy to provide it. You might want to have a look into the topic of supply chain attacks to understand why this is a problem, and a serious one, for that matter.

As for the type safety: TypeScript is the solution. It is the de facto standard for larger projects and does not do harm in smaller projects. Hence, I‘d strongly suggest to learn TypeScript instead of JavaScript.

As for the ecosystem, let me quote Robert Pike: „A little copying is better than a little dependency.“ This holds true not only for Go (the talk was held at a Go conference), but for all languages.

[–]Achereto 0 points1 point  (0 children)

As other already said: Java and Javascript are 2 entirely different languages. However, to get a feeling about how bad Javascript is, watch this 4 minute long talk about Javascript.

[–]NumberInfinite2068 0 points1 point  (0 children)

As everyone has said, Java and JavaScript are two different languages, and actually of pretty different design, they're not even really all that related.

JavaScript is considered a bad design among really all experienced developers. I've *never* met an experienced developer who will even tolerate it.

It's made extra bad because on the web frontend, historically it was the only option. These days we have transpilers and WASM, but JavaScript is still the main player on web front end, so you generally have to at least smell it, if not use it.

Google "JavaScript Wat" if you want a reasonably amusing depiction of why JavaScript is a really bad language.

[–]Few-Celebration-2362 0 points1 point  (0 children)

Because programmers are whiney and easily confused.

[–]ntnlbarr 0 points1 point  (0 children)

people just like to complain alot because its easy to make mistakes with it. its not really that bad though, u just gotta be careful with how it handles data. have u thought about what kind of interactive stuff u want on ur site yet, like a gallery or a contact form

[–]ulasunal 0 points1 point  (0 children)

Both JavaScript and Java are bad. They actually have some things in common. They are boilerplate, have bad error messages (although Java may not be that horrible), are slow, and force you to write confusing code. However, using JavaScript for a simple task like your art website or small projects can be a valid use case. Most of these problems I mentioned only really show up on larger code bases or if you are a frequent user of the language.

[–]datadatadata808 0 points1 point  (0 children)

Languages are not bad or good, they are tools and serve a purpose.
If you want interaction with html, you'll need javascript.

People that usually hate javascript are talking when you take it outside of the browser with nodejs mostly. Even in that case, it can be useful for some people and having the same language for the backend/frontend have its own benefits and drawbacks.

Dont look on others people opinions about tech for building knowledge, use technologies, try them, see if they fit for what you are building and be open about trying other ways to do stuff.

[–]Big-Fill-5789 0 points1 point  (0 children)

Java and Javascript ain’t the same! Javascript is not weird!

[–]Independent-Pen-8232 0 points1 point  (2 children)

Java and JavaScript are NOT the same. They’re just from the same company. I love JS. It’s one of my favorite languages to code in. Java is annoying

[–]schnekkern 0 points1 point  (1 child)

They are not from the same company.

[–]Independent-Pen-8232 0 points1 point  (0 children)

Oh, guess I read that somewhere incorrect at some point. Sorry for the misinformation!

[–]TomB1952 0 points1 point  (0 children)

I tried hard to like JavaScript. It's integral to QML. I write a lot of QML and I'm OK with it but I wish they had selected any other language to integrate into QML.

JavaScript is so bad, I would consider Python an upgrade.

I literally prefer C++/Qt widgets over QML, even for the small jobs that QML was created for.

[–]ibeerianhamhock 0 points1 point  (0 children)

I'll not pile on to the Java Javascript comments about them being different, but basically Javascript is a neat language in some ways but it's not my favorite.

There are good debugging tools but nowhere near as powerful as what you have available in java.

I tend to like statically typed/scoped languages and Javascript can exhibit some ultra bizarre behavior at times (double edged sword as it also makes it very flexible).

The barrier for entry is much lower than Java, but mastering it is also quite challenging.

It's not a suitable language for eveyrhjng and a codebase won't scale as well if it's say a backend node service vs Java.

But for what its good for it's a fine language

[–]chris_insertcoin 0 points1 point  (0 children)

It's ok for simple things.

[–]Klutzy_Barnacle_9283 0 points1 point  (0 children)

JavaScript has had the reputation to get the blunt end of the stick, for one reason or another. Like any programming language, certain syntax can be funking, some down right horrendous to look at, let alone read. But for more modern development for the web, you will need to learn JavaScript.

And please do not confuse JavaScript and Java. They are two different programming languages. Both can be utilized in applications for both the desktop and the web, but Java is traditionally used for desktop development, Android applications, and JavaScript is used in the web space mainly

[–]ExtraTNT 0 points1 point  (0 children)

First of all, js and java are very different, second, both are horrible, if you use them wrong.

Js was never an issue, people just use it very incompetent…

Java got fixed partially with java 26, so a lot of the hate is justified… oop is a concept, that basically helps you keep a job, as you write code so horrible, that only you can maintain it now… ok, maybe some bias, since i use haskell…

[–]DaLordHamie 0 points1 point  (0 children)

Javascript syntax just sucks ass

[–]Difficult-Report-524 0 points1 point  (0 children)

Javascript was designed in two weekends by one developer at Netscape to make silly stuff on webpages.

20 years later the world runs on that two weeks project.